You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This opens the possibility for a privilege escalation as any user might create the file /tmp/drupwn.txt in advance and redirect its output through a symbolic link. Rewritting ~/.ssh/authorized_keys for example gives shell access to that user's account.
Granted most pentesters don't run security tools on shared machines, but there is no reason to leave that door open either. A securely opened and randomly named file should be used instead:
import tempfile
if status:
self.fd = tempfile.NamedTemporaryFile(prefix="drupwn-", suffix=".txt", mode="w")
(mktemp is not secure in python, mkstemp isn't nice to work with,
TemporaryFile doesn't create an actual file on linux so it's no good for
logging, hence NamedTemporaryFile.)
Bonus: that also makes drupwn less platform dependent.
The text was updated successfully, but these errors were encountered:
This issue has been partially fix in the release 0.9.2. However, we still use the /tmp/ folder to save the logs. Indeed, knowing where this information are stored is inescapable to retrieve them using the docker image.
In engine/Logger.py line 13 we read:
This opens the possibility for a privilege escalation as any user might create the file /tmp/drupwn.txt in advance and redirect its output through a symbolic link. Rewritting ~/.ssh/authorized_keys for example gives shell access to that user's account.
Granted most pentesters don't run security tools on shared machines, but there is no reason to leave that door open either. A securely opened and randomly named file should be used instead:
(mktemp is not secure in python, mkstemp isn't nice to work with,
TemporaryFile doesn't create an actual file on linux so it's no good for
logging, hence NamedTemporaryFile.)
Bonus: that also makes drupwn less platform dependent.
The text was updated successfully, but these errors were encountered: