Summary
A cross-site request forgery vulnerability in phpMyAdmin allows an attacker to cause an authenticated user's browser to submit unauthorized SQL requests without a valid CSRF token. If a victim is logged in and can be induced to submit a crafted cross-site POST request, SQL may execute with that user's database privileges.
A cross-site request forgery vulnerability in phpMyAdmin allows an attacker to cause an authenticated user's browser to submit unauthorized SQL requests without a valid CSRF token. If a victim is logged in and can be induced to submit a crafted cross-site POST request, SQL may execute with that user's database privileges.
Affected context
The issue affects phpMyAdmin deployments through version 5.2.3 where non-AJAX POST requests to SQL execution endpoints do not consistently enforce CSRF token checks. Risk is greatest when users authenticate through HTTP or configuration-based authentication, remain logged in, and have database privileges that permit meaningful SQL operations.
The issue affects phpMyAdmin deployments through version 5.2.3 where non-AJAX POST requests to SQL execution endpoints do not consistently enforce CSRF token checks. Risk is greatest when users authenticate through HTTP or configuration-based authentication, remain logged in, and have database privileges that permit meaningful SQL operations.
Exploit preconditions
- Attack surface: Web-based SQL request endpoints, including
/sqland/database/sql - Required access: An authenticated phpMyAdmin session held by the victim
- User interaction: The victim must be induced to submit or visit attacker-controlled content that causes a cross-site POST
- Trigger point: Processing of a non-AJAX POST request carrying SQL-related parameters
- Why exploitation is possible: The request may be accepted without a valid CSRF token, allowing the victim's authenticated browser session to authorize the operation
- Attack surface: Web-based SQL request endpoints, including
/sqland/database/sql - Required access: An authenticated phpMyAdmin session held by the victim
- User interaction: The victim must be induced to submit or visit attacker-controlled content that causes a cross-site POST
- Trigger point: Processing of a non-AJAX POST request carrying SQL-related parameters
- Why exploitation is possible: The request may be accepted without a valid CSRF token, allowing the victim's authenticated browser session to authorize the operation
Why this happens
The vulnerability results from inconsistent CSRF enforcement for state-changing, non-AJAX POST requests. When a server relies on the victim's ambient authentication cookies but does not require a valid, session-bound anti-CSRF token or equivalent request-origin validation, an external site can cause the browser to send an authenticated request. This behavior maps to CWE-352: Cross-Site Request Forgery.
The vulnerability results from inconsistent CSRF enforcement for state-changing, non-AJAX POST requests. When a server relies on the victim's ambient authentication cookies but does not require a valid, session-bound anti-CSRF token or equivalent request-origin validation, an external site can cause the browser to send an authenticated request. This behavior maps to CWE-352: Cross-Site Request Forgery.
Potential impact
- Unauthorized SQL statements may be executed with the victim's database privileges
- Database records could be modified, deleted, or corrupted
- Sensitive database contents may be exposed through attacker-induced operations
- Application availability or data integrity could be affected
- Higher-privileged database accounts could increase the severity of resulting damage
- Unauthorized SQL statements may be executed with the victim's database privileges
- Database records could be modified, deleted, or corrupted
- Sensitive database contents may be exposed through attacker-induced operations
- Application availability or data integrity could be affected
- Higher-privileged database accounts could increase the severity of resulting damage
General mitigation guidance
Mitigation generally focuses on enforcing request authenticity for every state-changing operation.
Common defensive patterns include:
- Require unpredictable, session-bound CSRF tokens on all relevant POST requests, including non-AJAX requests
- Apply consistent server-side token validation before processing SQL-related actions
- Use origin or referer checks as an additional control where appropriate
- Configure cookies with secure, HttpOnly, and suitable SameSite attributes
- Limit phpMyAdmin and database accounts to the minimum privileges required
- Avoid exposing administrative interfaces broadly and require strong authentication
- Separate high-privilege database operations from routine user sessions
Mitigation generally focuses on enforcing request authenticity for every state-changing operation.
Common defensive patterns include:
- Require unpredictable, session-bound CSRF tokens on all relevant POST requests, including non-AJAX requests
- Apply consistent server-side token validation before processing SQL-related actions
- Use origin or referer checks as an additional control where appropriate
- Configure cookies with secure, HttpOnly, and suitable SameSite attributes
- Limit phpMyAdmin and database accounts to the minimum privileges required
- Avoid exposing administrative interfaces broadly and require strong authentication
- Separate high-privilege database operations from routine user sessions
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis and code review checks for state-changing routes that lack CSRF validation
- Tests that submit cross-origin form requests to every administrative POST endpoint
- Verification that token validation occurs before SQL parsing or execution
- Web server and application logs showing unexpected SQL actions associated with otherwise normal user sessions
- Policy enforcement requiring CSRF protection for all browser-authenticated state-changing requests
- Automated security testing tools that assess CSRF coverage across authenticated workflows
Organizations can look for this weakness through:
- Static analysis and code review checks for state-changing routes that lack CSRF validation
- Tests that submit cross-origin form requests to every administrative POST endpoint
- Verification that token validation occurs before SQL parsing or execution
- Web server and application logs showing unexpected SQL actions associated with otherwise normal user sessions
- Policy enforcement requiring CSRF protection for all browser-authenticated state-changing requests
- Automated security testing tools that assess CSRF coverage across authenticated workflows

