OpenEMR GACL cross-site request forgery vulnerability
The GACL pages in OpenEMR lack CSRF protection, allowing an attacker to make a logged-in admin perform unintended actions. By combining this with SQL injection or XSS flaws in phpGACL, an attacker could steal admin credentials or execute arbitrary database queries.
Originally disclosed on Cisco Talos
A cross-site request forgery vulnerability exists in the GACL functionality of OpenEMR 5.0.2 and development version 6.0.0 (commit babec93f600ff1394f91ccd512bcad85832eb6ce). A specially crafted HTTP request can lead to the execution of arbitrary requests in the context of the victim.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The phpGACL pages in OpenEMR do not verify a CSRF token, unlike other OpenEMR pages.
Impact
An attacker could steal OpenEMR administrator credentials and execute arbitrary queries in the underlying database, though session stealing would be prevented if the httpOnly flag were set.
What the attacker needed
Victim is an OpenEMR admin; victim visits attacker's page or link; attacker knows OpenEMR URL
The fix
The report does not state a fix, but CSRF tokens should be added to all phpGACL pages, and the httpOnly flag should be set on session cookies.
How it was found
- An attacker sets up a malicious webpage containing JavaScript that sends a POST request to the GACL endpoint.
- The attacker directs an OpenEMR admin to visit that page.
- The admin's browser sends the request with the admin's session cookie, exploiting a SQL injection or XSS flaw.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Cross-site request forgery (CSRF) is when a malicious website tricks a logged-in user's browser into sending a request to another site where the user is authenticated. Here, the GACL pages did not check for a secret token that proves the request came from the legitimate site, so an attacker could make an admin's browser send commands to OpenEMR without the admin's knowledge.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.