Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

New GTFOBin: getent for extracting privileged NSS entries via SUID #503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
thegreatmhn wants to merge 1 commit into GTFOBins:master
base: master
Choose a base branch
Loading
from thegreatmhn:thegreatmhn-patch-1

Conversation

@thegreatmhn
Copy link

@thegreatmhn thegreatmhn commented Jun 10, 2025


description: |
getent is a command-line utility used to fetch entries from administrative databases
configured 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 system
accounts, including root.

Under normal circumstances, getent requires root privileges to access the shadow database.
However, if the getent binary has the SUID bit set, a low-privileged user can abuse it to
retrieve 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 or hashcat. This is a stealthy and shell-less method of privilege escalation that
works 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 for
inclusion in GTFOBins under the suid vector.

Example:

./getent shadow root
# root:6ドル$saltsalt$abc...xyz:19429:0:99999:7:::

---
description: |
 `getent` is a command-line utility used to fetch entries from administrative databases 
 configured 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 system 
 accounts, including `root`.
 Under normal circumstances, `getent` requires root privileges to access the `shadow` database. 
 However, if the `getent` binary has the SUID bit set, a low-privileged user can abuse it to 
 retrieve 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` or `hashcat`. This is a stealthy and shell-less method of privilege escalation that 
 works 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 for 
 inclusion in GTFOBins under the `suid` vector.
 Example:
 ```bash
 ./getent shadow root
 # root:6ドル$saltsalt$abc...xyz:19429:0:99999:7:::
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /