New GTFOBin: getent for extracting privileged NSS entries via SUID #503
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.
description: |
getent
is a command-line utility used to fetch entries from administrative databasesconfigured in the system’s Name Service Switch (NSS), such as
passwd
,group
,hosts
,and critically,
shadow
. While most of these databases are readable by regular users,the
shadow
database is highly sensitive, containing hashed passwords for all systemaccounts, including
root
.Under normal circumstances,
getent
requires root privileges to access theshadow
database.However, if the
getent
binary has the SUID bit set, a low-privileged user can abuse it toretrieve password hashes, thus violating the integrity of the authentication system.
The attacker can extract these hashes and then perform offline cracking using tools like
john
orhashcat
. This is a stealthy and shell-less method of privilege escalation thatworks in restricted environments and minimal systems where only core utilities exist.
This abuse works without invoking an interactive shell, interpreter, or script engine, and
relies purely on the logic of
getent
and the SUID bit — making it a candidate forinclusion in GTFOBins under the
suid
vector.Example:
./getent shadow root # root:$6$saltsalt$abc...xyz:19429:0:99999:7:::