Security Lessons from TVM’s RPC Design
The TVM RPC server accepts uploaded tar archives and automatically compiles and loads object files, executing any constructor functions they contain. An attacker with access to the RPC server could achieve remote code execution by uploading a malicious archive.
medium.com
Published on medium.com
Apache TVM is a modern ML compiler: lightweight, modular, and, as it turns out, a bit naive. Its RPC server is an important part of the infrastructure, allowing models to be sent to remote devices where they are built and executed.
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 write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The RPC server extracts uploaded archives and automatically compiles and loads object files without validating their contents or sandboxing execution.
Impact
An attacker who can access the RPC server could execute arbitrary code on the remote device, potentially leading to a supply chain attack if malicious archives are distributed.
What the attacker needed
Access to the RPC server
The fix
The text suggests filtering archive contents, adding a strict mode, performing static ELF analysis, isolating execution, verifying integrity, and logging warnings, but does not state that a fix was implemented.
How it was found
- Connect to the RPC server.
- Upload a tar archive containing a malicious object file.
- Load the module from the archive, which triggers compilation and loading.
- The constructor function in the object file executes, running the payload.
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 write-up has not been written yet. The Original tab links to the source.
Apache TVM is a tool for running machine learning models on remote devices. Its RPC server lets you send a model file, which it unpacks and runs. The problem is that it will run any code inside that file without checking, so someone who can send a file can run their own commands on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.