subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
return str(shim_so) src = Path(tempfile.gettempdir()) / "lo_socket_shim.c" src.write_text(_SHIM_SOURCE) subprocess.run( ["gcc", "-shared", "-fPIC", "-o", str(shim_so), str(src), "-ldl"], check=True, capture_output=True, )- Confidence
- 94% confidence
- Finding
- This code compiles native C source at runtime into a shared object in a world-writable temporary directory, then later uses it for process injection. Even though the source is hardcoded, shipping a document-conversion skill with on-demand native compilation materially increases attack surface and can be abused in environments where the tool runs with elevated trust or where temp-file races/symlink attacks are possible.
