Added chdir in privesc to prevent weird permission denied erros during privilege escalation

This commit is contained in:
Caleb Stewart 2020-07-19 14:51:13 -04:00
parent f6a94254bb
commit ae47f85d67
2 changed files with 8 additions and 0 deletions

2
.gitignore vendored
View File

@ -12,3 +12,5 @@ testing/
data/pwncat.sqlite-journal
pwncat.sqlite-journal
linpeas.txt
NOTES.md

View File

@ -380,6 +380,12 @@ class Finder:
readers: List[Technique] = []
writers: List[Technique] = []
# A previous escalation attempt may have left us in a working directory
# that causes problems during escalation (e.g. a home directory). Ensure
# we are in a safe directory
pwncat.victim.flush_output()
pwncat.victim.chdir("/tmp")
for technique in techniques:
if Capability.SHELL in technique.capabilities:
try: