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
- 96% confidence
- Finding
- The code invokes gcc at runtime to compile native code from a temporary source file, which materially expands the execution surface beyond document inspection. In combination with later LD_PRELOAD injection, this creates a code-execution/manipulation path that is risky in sandboxed or shared environments and can be abused if the temp-path artifacts are replaced or raced.
