[LINPEAS] Add privilege escalation check: HTB WhiteRabbit n8n HMAC Forgery, SQL In... #535
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 blog post contains a privilege escalation technique that is both local and generic enough to be relevant for real-world Linux environments, not just CTFs. Specifically:
restic sudo abuse via --password-command:
/usr/bin/resticas root via sudo (e.g.,bob ALL=(ALL) NOPASSWD: /usr/bin/restic).--password-commandwhich executes an arbitrary command to obtain the backup password. When restic is invoked via sudo, this helper command runs with elevated privileges.sudo restic check --password-command 'cp /bin/bash /tmp/suidbash'sudo restic check --password-command 'chmod 6777 /tmp/suidbash'/tmp/suidbash -pto get a root shell.tar,rsync,less,ftp,openssl, backup tools, etc.sudo resticis a plausible configuration for delegated backup tasks. The abuse relies on a generic feature of restic (--password-command), not a custom script or niche, fixed CVE.Other tricks in the post (n8n HMAC forgery, n8n SQLi, time-seeded password generator) are either:
So they do not meet the criteria for inclusion in linpeas.
Thus, the only clearly reusable, generic local privilege escalation technique suitable for linpeas is the restic
--password-commandsudo-abuse pattern on Linux.🤖 Implementation Details
PEASS linpeas agent completed successfully with 98 items. Agent Comment: Summary:
UG_Sudo_restic(linPEAS/builder/linpeas_parts/6_users_information/19_Sudo_restic.sh) to automatically detect sudo rules that allow runningrestic, highlighting that the--password-commandoption executes helper commands as root. The module:resticis present inPATH.sudo -n -loutput (and, when available,sudo -S -lusing$PASSWORD) plus readable/etc/sudoersand/etc/sudoers.d/*files for lines containingrestic.sudo restic check --password-command 'cp /bin/bash /tmp/restic-root && chmod 6777 /tmp/restic-root') to remind operators how to escalate.echo_not_foundwhen no risky configuration is observed.linPEAS/README.mdwith a “Recent updates” section noting the new restic--password-commanddetection so the documentation reflects the added coverage.Testing:
bash -n linPEAS/builder/linpeas_parts/6_users_information/19_Sudo_restic.sh🏗️ Builder Agent Response
LinPEAS build agent completed successfully with 26 items. Agent Comment: LinPEAS now builds successfully.
What I did
/tmp/hacktricks_update_dkj547wj/repo/linPEASusingpython3 -m builder.linpeas_builder --all --output /tmp/linpeas_fat.sh, which surfaced metadata validation errors for modulebuilder/linpeas_parts/6_users_information/19_Sudo_restic.sh.$restic_bin,$restic_sudo_found,$sudo_no_pw_output,$sudo_with_pw_output,$matches,$sudo_file,$block,$origin) is listed under Generated Global Variables, as required by the builder./tmp/linpeas_fat.sh.Let me know if you need any additional adjustments or verifications.
This PR was automatically created by the HackTricks Feed Bot. Please review the implementation carefully and test thoroughly before merging.