CVE-2024-47169: Remote Code Execution in Agnai via JavaScript upload with directory traversal
A vulnerability in Agnai versions before 1.0.330 allows attackers to upload arbitrary JavaScript files to attacker-specified locations through insufficient validation of upload parameters, potentially enabling remote code execution on publicly exposed instances without S3-compatible storage.
What happened
A vulnerability in Agnai versions before 1.0.330 permits attackers to upload arbitrary files to attacker-chosen locations on the server by exploiting insufficient validation and sanitization of the _id parameter and filename/content variables in the upload functionality.
Attackers can specify arbitrary file types and base64-encoded file content to upload JavaScript files and control their location on the server, enabling remote code execution.
Reported impact
The vulnerability could result in unauthorized access, full server compromise, and data leakage on publicly hosted installations without S3-compatible storage.
The vulnerability does not affect Agnai.chat installations using S3-compatible storage or self-hosting that is not publicly exposed.
Index analysis
The vulnerability involves path traversal (CWE-35) and unrestricted upload of dangerous file types (CWE-434).
The issue stems from improper validation of the _id parameter in the character endpoint and lack of sanitization of filename and content variables in the upload function.
Governance controls
Agnai released version 1.0.330 with a patch addressing the vulnerability.
Classification
Sources and evidence
This record was researched and written by the Index, based on the following original reporting.