Summary
Adminer contains a remote code execution vulnerability in SQLite query handling because the VACUUM INTO operation is not blocked when other database attachment controls are applied. An authenticated attacker may write PHP code to an arbitrary server-side path and execute commands when that file is later processed by the server.
Affected context
The vulnerability occurs in Adminer deployments that allow authenticated users to issue SQLite queries and expose a PHP-capable or otherwise executable server-side file path. It becomes risky when database query controls restrict ATTACH operations but do not apply equivalent protections to file-writing behavior through SQLite maintenance features.
Exploit preconditions
- Attack surface: Adminer's authenticated SQLite query interface
- Required access: Valid credentials with permission to execute SQLite queries
- Trigger point: Processing of a SQLite VACUUM INTO operation
- Why exploitation is possible: The operation can write attacker-controlled
content to a server-side path despite restrictions intended to limit related
SQLite file-access behavior
Why this happens
The underlying bug is incomplete enforcement of dangerous SQLite operations during query handling. Blocking ATTACH without also restricting other statements that can create or overwrite files leaves an alternate path for attacker-controlled content to reach executable server locations. This maps to CWE-94, Improper Control of Generation of Code, because written content may subsequently be interpreted as server-side code.
Potential impact
- An attacker may execute arbitrary commands with the privileges of the web server
- Server-side application files could be created, overwritten, or tampered with
- Database contents and application data could be disclosed or modified
- The affected host could be used for persistence or lateral movement
- Service availability and application integrity could be compromised
General mitigation guidance
Mitigation generally focuses on restricting database features that can write
to the filesystem and reducing the trust placed in authenticated query users.
Common defensive patterns include:
- Denying or safely handling SQLite statements with filesystem-writing behavior
- Applying consistent policy enforcement across all query execution paths
- Preventing the web server from executing files in user-writable directories
- Separating database administration interfaces from production web roots
- Using least-privilege service accounts and filesystem permissions
- Restricting access to Adminer through strong authentication and network controls
- Treating authenticated database users as potentially untrusted for code-generation purposes
How teams detect issues like this
Detection approaches may include:
- Static analysis and query-policy rules that identify unblocked SQLite file-writing statements
- Code review checks for allowlists that omit filesystem-affecting SQL operations
- Monitoring Adminer audit logs for unusual SQLite maintenance statements
- File-integrity monitoring for unexpected PHP or script files in web-served directories
- Web-server telemetry for newly created scripts followed by unusual command execution
- Policy enforcement preventing administrative database tools from writing to executable paths

