add check to detect OS (Debian) where su-bruteforce cannot be used #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, I noticed during a CTF that su-bruteforce didn't work for some reason.
After digging a bit, it's because of the OS.
su from Debian will not authorize the use of su without a terminal
I found the relevant code here:
https://sources.debian.org/src/shadow/1:4.5-1.1/src/su.c/?hl=720#L720
I think this problem is still relevant
https://sources.debian.org/src/shadow/1%3A4.8.1-1/src/su.c/#L721
Since the current code discard the stderr, the current behavior is a false negative.
So I added a check, a message and stop the script in case it can't be used against this type of OS
PS: the relevant CTF
https://tryhackme.com/room/jackofalltrades
Debian 3.16.7
EDIT:
I noticed that linpeas already contains a check to see if su exists: peass-ng/PEASS-ng#363
and a check on the "must be run from a terminal" that already existed
So I ported them instead.