[LINPEAS] Add privilege escalation check: HTB Dump — Zip argument injection to RCE... #517
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.
🔧 Automated Privilege Escalation Check Addition
🤔 Privilege Escalation Reasoning
The post documents a general and realistic sudoers misconfiguration pattern involving tcpdump that enables local privilege escalation. Specifically, a NOPASSWD sudo rule allows running /usr/bin/tcpdump with -w constrained by a globbed path and -F constrained by a filter path. Because the rule permits globbing and does not fully constrain additional options, an attacker can: (1) satisfy the sudoers pattern with the first -w, then supply a second -w to redirect output to an arbitrary path; (2) use -Z root to prevent privilege dropping and force root-owned outputs; (3) use -r to replay attacker-crafted pcap data into chosen files (e.g., /etc/sudoers.d), effectively achieving root; and (4) abuse -V to coerce reads that leak sensitive content via diagnostics. These abuses are well-known, tool-agnostic, and occur in real environments where tcpdump is granted via sudo with insufficient argument restrictions. This is an ideal candidate for linpeas to detect and highlight as a high-risk sudoers misconfiguration. The zip filename option injection is an application-specific remote RCE vector, not a local privesc technique suitable for linpeas/winpeas.
🤖 Implementation Details
PEASS linpeas agent completed successfully with 110 items. Agent Comment: Work completed in /tmp/hacktricks_update_4lr52ni7/repo
Code inserted (end of 7_Sudo_l.sh):
Extra: Detect tcpdump sudoers patterns that can be abused (wildcards/-w/-Z/-r/-V)
_tcpdump_sudol="$( (echo "" | timeout 1 sudo -S -l) 2>/dev/null )"
if [ -z "$_tcpdump_sudol" ] && [ "$PASSWORD" ]; then
_tcpdump_sudol="$( (echo "$PASSWORD" | timeout 1 sudo -S -l) 2>/dev/null )"
fi
if echo "$_tcpdump_sudol" | grep -q "/tcpdump"; then
echo "Potentially dangerous sudo tcpdump rule(s) found:" | sed -${E} "s,.,${SED_RED_YELLOW},g"
printf "%s\n" "$_tcpdump_sudol" | grep tcpdump | sed -${E} "s,.,${SED_RED},g"
print_info "tcpdump via sudo is commonly exploitable if arguments are not fully pinned (e.g., globbed -w path). Consider trying:"
echo " sudo tcpdump -c10 -w <allowed_path> -w /dev/shm/out.pcap -F <allowed_filter>" | sed -${E} "s,.,${SED_GREEN},g"
echo " sudo tcpdump -c10 -w <allowed_path> -Z root -w /dev/shm/root-owned -F <allowed_filter>" | sed -${E} "s,.,${SED_GREEN},g"
echo " sudo tcpdump -c10 -w <allowed_path> -Z root -r crafted.pcap -w /etc/sudoers.d/linpeas -F <allowed_filter>" | sed -${E} "s,.,${SED_GREEN},g"
echo " sudo tcpdump -c10 -w <allowed_path> -V /root/secret -w /tmp/dummy -F <allowed_filter>" | sed -${E} "s,.,${SED_GREEN},g"
echo " (use with caution; ensure correct perms, e.g., 440 for sudoers.d)" | sed -${E} "s,.*,${SED_GREEN},g"
echo ""
fi
Summary of the added detection
Why this meets the guidelines
🏗️ Builder Agent Response
LinPEAS build agent completed successfully with 26 items. Agent Comment: Done. LinPEAS builds successfully.
What I did:
Verification:
No fixes were necessary since the build succeeded on the first attempt. If you want me to also produce a non-fat or small build, tell me which flags to use.
This PR was automatically created by the HackTricks Feed Bot. Please review the implementation carefully and test thoroughly before merging.