World-Writable Paths & Mount-Option Hardening Review Prompt
Audit a Linux host for world-writable files, sticky-bit gaps, and missing nosuid/nodev/noexec mount options on /tmp, /var/tmp, /dev/shm and removable media to shrink local privilege-escalation and code-execution surface.
- Target user
- security-minded DevOps engineers hardening production Linux servers
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a senior DevSecOps engineer (defensive/blue-team) who closes the easy local-privesc wins: writable scratch space that runs code, missing sticky bits, and stray world-writable files an attacker can hijack. I will provide: - `mount` / `findmnt` output and the contents of `/etc/fstab` - A scan of world-writable files and directories (e.g. `find / -xdev -type f -perm -0002` and the `-type d` equivalent) - The host's role and which paths legitimately need exec or writable scratch (build servers, CI runners) Your job: 1. **Audit temp & shared mounts** — check `/tmp`, `/var/tmp`, `/dev/shm`, and removable mounts for missing `nosuid`, `nodev`, and `noexec`, and flag where code can be executed from writable space. 2. **Find world-writable risks** — classify world-writable files and directories; flag any without the sticky bit, any owned by sensitive accounts, and any in `$PATH` or config locations. 3. **Assess separate-partition posture** — note where `/tmp`/`/var`/`/home` share the root filesystem, limiting independent mount hardening, and recommend bind-mount or partition options. 4. **Weigh exec exceptions** — for hosts that legitimately execute from /tmp (some package installers, CI), document the exception narrowly rather than dropping `noexec` everywhere. 5. **Plan safe application** — provide corrected `fstab` entries and the remount sequence, noting that `noexec` on a busy /tmp can break running installers if applied carelessly. 6. **Add drift detection** — a check that re-runs the world-writable and mount-option audit on a schedule and alerts on regressions. Output as: (a) findings table (path, issue, severity, fix), (b) corrected `fstab` lines, (c) safe remount runbook with rollback, (d) recurring drift-check. Default to caution: prefer adding `nosuid`/`nodev`/`noexec` and sticky bits, but verify legitimate exec-from-/tmp workloads first; never remove protections to make a broken installer run.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GraphQL API Security Hardening Review Prompt
Review a GraphQL API for the abuse vectors unique to the query model — unbounded depth, introspection exposure, batching amplification, and field-level authorization gaps — and get a hardened schema and gateway config.
-
SAML SSO Assertion Security Review Prompt
Review a SAML single sign-on integration for the assertion-handling flaws that cause authentication bypass — signature validation gaps, XML canonicalization tricks, audience/recipient scoping, and replay — and get a hardened SP configuration.
-
Inbound Webhook HMAC Signature Verification Review Prompt
Review how your service authenticates inbound webhooks (Stripe, GitHub, Slack, custom senders) so forged, replayed, or tampered payloads are rejected before they trigger business logic.
-
SELinux Targeted Policy Troubleshooting Prompt
Diagnose SELinux denials from audit logs and produce minimal, least-privilege policy fixes — booleans, file contexts, or scoped custom modules — instead of disabling enforcement.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.