InternLM LMDeploy code injection via unsafe exec in conf.py
A code injection vulnerability was reported in InternLM's LMDeploy project in its conf.py file, which uses unsafe exec and compile functions to execute version.py. An attacker could exploit this by tampering with the version file to inject malicious code.
What happened
Code in lmdeploy/docs/en/conf.py uses exec and compile functions to read and execute a version.py file without validation. The vulnerable code reads a file with open(version_file, 'r') and then executes it using exec(compile(f.read(), version_file, 'exec')).
The vulnerability affects all versions from August 2023 to January 2025. An attacker who tampers with the version.py file could inject malicious code to delete files, execute unauthorized system commands, or steal sensitive information.
Classification
Sources and evidence
Sources not yet published
This record was researched and written by the Index from original reporting. Its sources are still being verified by an editor, and they are listed here once that check is complete. Until then the record carries no reviewer.