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 writes C source into a world-writable temporary directory and then compiles it into a shared object that is later injected with LD_PRELOAD. Using predictable temp paths for source and output introduces a path/symlink race that can let a local attacker replace files, influence compilation, or cause arbitrary shared libraries to be loaded into the LibreOffice process.
