Linux escalation via file, PATH and library manipulation — PATH hijacking of relative commands run by privileged processes, writable shared libraries / LD_PRELOAD / LD_LIBRARY_PATH abuse, writable /etc/passwd or /etc/shadow or sudoers, world-writable sensitive files, and NFS no_root_squash. Identification, safe PoC, remediation.
16 stars
0 votes
0 copies
2 views
Added November 17, 2026
securityrustshellbackend
Security analysis
B75/100
criticalAccesses sensitive system or user directories
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Linux File Path Abuse?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-linux-file-path-abuse)
---
name: linux-file-path-abuse
description: Linux escalation via file, PATH and library manipulation — PATH hijacking of relative commands run by privileged processes, writable shared libraries / LD_PRELOAD / LD_LIBRARY_PATH abuse, writable /etc/passwd or /etc/shadow or sudoers, world-writable sensitive files, and NFS no_root_squash. Identification, safe PoC, remediation.
---
# File / PATH / Library Abuse
When a privileged process trusts a path, library, or file you can write, you control its execution or escalate directly. Prove safely, revert.
## Trigger phrases
`path hijack, ld_preload, ld_library_path, writable /etc/passwd, writable shadow, nfs no_root_squash, library hijack`
## Identify & exploit (safe PoC)
- **PATH hijack:** a root process/SUID calls a command by relative name. Place a benign script named like that command earlier in PATH that writes a root marker; confirm; remove it.
- **LD_PRELOAD / LD_LIBRARY_PATH:** if `sudo` keeps these env vars (`env_keep`) or a SUID binary loads a writable lib, build a tiny benign `.so` whose constructor runs `id`; confirm root context; delete it.
- **Writable `/etc/passwd`:** add a known-password root-UID entry **only in a lab/authorized context** (Tier-2 caution) and prove login, then remove the line; on production prefer proving write access without adding an account.
- **Writable `/etc/sudoers(.d)`:** demonstrate you could grant yourself sudo; prefer showing write access over actually editing on production.
- **NFS `no_root_squash`:** mount the export, place a root-owned SUID benign binary from the attacker side, execute on target to prove; clean up.
- **World-writable sensitive files / backups**: read creds for reuse.
## Safe-PoC discipline
Benign markers / read-proofs on production; destructive proofs (passwd/sudoers edits) only in lab/authorized Tier-2 mode, always reverted and logged.
## Remediation to report
Absolute paths in privileged scripts, remove `env_keep` for LD_*, correct permissions on `/etc/passwd|shadow|sudoers`, `root_squash` on NFS, fix world-writable files.
## Backend / Verification
Target shell. **Background-verify** the escalation reproduces (marker owned by root / `id` shows root) before CONFIRMED.
## Evidence
The writable path/lib/file, the benign proof, remediation. Revert everything.