subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
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
- 95% confidence
- Finding
- The code compiles a shared object at runtime with gcc and later injects it via LD_PRELOAD. Runtime native compilation materially increases risk because it depends on PATH-resolved toolchains, writes executable artifacts in a shared temp directory, and creates a powerful code-execution primitive that is far beyond ordinary document handling.
