Don't cache username in ssh checksec output#2702
Don't cache username in ssh checksec output#2702peace-maker merged 10 commits intoGallopsled:devfrom
Conversation
Include username in cache file path for better uniqueness.
|
We could remove the username:host from the cache too. I'm not sure if there might be weird usernames required in some challenges including |
|
Nice idea, looks like os.path.join isn't sanitizing the fields so it can get
about the user's input to filenames, with self.host/self.port/self.user, I think it's a weird situation where you can login to a SSH server and also be able to set a path with these vars (only if you control pwntools machine name resolution/connecting with a "../" user, I also do not know servers hosting pwntools as a service). If we want to start sanitizing any var, I think there's much more work to do and we need to think if it's cost-effective (start using sanitize libraries for the whole project). Tell me what do you think before I work :) |
|
Yes, adding that fingerprint to the filename and not including user@host in the cache is a good idea. We shouldn't exclude some weird valid usernames just because of our caching mechanism, so thinking about ../ is worth it I think. |
045bb2c to
f1a2cad
Compare
…che path to be more unique & checksec is per ssh server and not attached to a user
|
Changing destination branch to dev, I did not make any python2.7 compatability. |
Allows the checksec output of the target server to be generated. Filenames cannot contain a colon ":".
Bug:
Currently the ssh checksec_cache path is unique by (host, port).
I can get a different user printed than the real one used if it was used before on the same ssh target.
It's unique because of the next line of code inside pwntools/pwnlib/tubes/ssh.py
Logging with ascii user:
Cache:
Made the it unique by (host, port, user) so data will be printed correctly.
If there's different environments by users it will help also.