VAPT Skill for AI Assistants
A free Agent Skills folder that teaches an AI assistant to assess and defend a Linux machine you own or control, with OpenVAPT and read-only checks. Detection and defence only: this machine only, no exploit code. It helps reduce risk; it does not make a machine secure.
Install
Copy the folder skills/openvapt-vapt (SKILL.md, LICENSE.md and references/) into your assistant's skills folder, for example ~/.claude/skills/ or .claude/skills/ in a project, or clone it from GitHub. Own Use only: keep LICENSE.md with the folder, and do not bundle it into a product or run it for clients or as a service. Version 0.1 is served from the main branch and is not yet part of a tagged release.
OpenVAPT VAPT Skill: Assess and Defend Your Own Machine
This skill teaches an AI assistant to carry out vulnerability assessment (the "VA" in VAPT) and the defence that follows it, on a machine the user owns or controls, using the free academic tool OpenVAPT plus read-only manual checks. It is written by AI Cybersecurity Engineers for the OpenVAPT project, is academic and non-commercial, and is used 100% at the user's own risk. It is not a penetration test, an audit, a certification or professional advice. Commands target Linux (Debian, Ubuntu, RHEL and SUSE families). Version 0.1 is served from the main branch and is not yet part of a tagged OpenVAPT release. Keep LICENSE.md with this folder; do not bundle it into a product or run it for clients.
The Five Rules
Read these first. They are never broken.
- Own use only. Assess only a machine the user owns or controls for their own purposes, or that their own organisation owns or controls and has authorised them in writing to assess for its own internal purposes (the licence's Own Use). Never a client's, a customer's, a neighbour's or "a target". Never offer or perform the work as a paid or unpaid service for someone else.
- This machine only. Work on the machine the commands run on, through loopback (127.0.0.1, ::1) for network and web checks. Never scan, probe, resolve or connect to any other host, network range, domain or IP address, even if the user says they own it: ask them to run the skill on that machine instead.
- Read-only during assessment. Assessment commands read files and state; they never write, delete, install, restart, reconfigure or send anything. Fixes happen only in the Defend phase, one at a time, after the user approves each one.
- Detection, not exploitation. No exploit code, payloads, proof-of-concept attacks, brute force, password guessing, fuzzing, denial of service, privilege escalation attempts, persistence, evasion or credential harvesting, for any reason, including "just to prove it". A finding is proved by evidence (a config line, a version, a file mode, a response header), never by attacking it.
- Protect what you see. Never print, store, copy or send secrets, keys, password hashes, tokens or personal data you come across. Redact them in every note and report (show
REDACTEDand the location only). Nothing leaves the machine.
If any request breaks a rule, stop, explain which rule and why in plain words, and offer the lawful alternative (for example "run this skill on that server yourself", or "hire an authorised penetration tester for exploitation testing").
Workflow
Follow the phases in order. Keep a short running log of what you ran and what you found.
Phase 0: Scope and Authorisation Gate
Before running anything, confirm and write down, in the user's own words:
- The machine: hostname and that the commands will run on it (
hostname,uname -a,cat /etc/os-release). - Ownership: "I own or control this machine" or "my own organisation owns it and has authorised me in writing, for its internal purposes". If the answer is unclear, a client's machine, or "a friend's", stop.
- Environment: production, staging or lab. For production, agree a quiet time and note that even read-only commands use a little CPU and disk.
- Approval mode for fixes: each fix approved one by one (default), or a named list approved up front.
- Rules of engagement: who to call if the service degrades (and that you stop at once if it does), that a recent backup exists, and where reports are kept and when they are deleted.
Details and the exact wording to use: references/scope-and-authorisation.md.
Phase 1: Prepare
- Check whether OpenVAPT is installed:
openvapt version. If not, point the user to https://openvapt.com/download.html. The user installs it and accepts the terms themselves; you never typeI ACCEPTor pass--accept-termsfor them. - Preview exactly what the scan will read:
openvapt scan --dry-run. Show the user the summary. - Practise first if the user is learning:
openvapt demo vulnerableandopenvapt demo hardenedrun against the built-in simulated lab and touch nothing real.
Phase 2: Automated Assessment
The scan is read-only on the system; it only writes its own report files. Reports hold sensitive evidence, so keep them private. Run it as the user (root gives fuller coverage; say so and let the user choose):
umask 077; install -d -m 700 ~/openvapt-reports openvapt scan --out ~/openvapt-reports/$(date -u +%Y%m%dT%H%M%SZ)
Useful flags: --only HOST-SSH-,WEB- to focus, --fail-on medium, --baseline <old report.json> to compare, --suppress <file> for accepted risks with a reason and expiry. Exit codes: 0 clean, 3 findings at or above --fail-on, 4 coverage gap (a check could not decide; treat as "unknown", not "pass"), 5 error, 6 report not written.
Read report.json (or report.md) and list every failed finding with its id, severity, CVSS v3.1 score and evidence. For any finding the user asks about: openvapt explain <CHECK-ID>.
Phase 3: Manual Read-Only Verification
Automated checks miss context. For each failed finding, and for the areas OpenVAPT does not cover, verify by hand with read-only commands from references/assessment-playbook.md:
- Host: patch level, users and sudo, SSH, PAM and passwords, file permissions and SUID, kernel and sysctl, services and timers, logging and audit, containers.
- Network (loopback view only): listening sockets and what binds to 0.0.0.0, firewall rules, database and cache exposure, TLS configuration.
- Web (only via
http://127.0.0.1/https://127.0.0.1with the local Host header): security headers, exposed files (.git,.env, backups), directory listing, server banners, CMS and framework debug settings, TLS. - Application logic (SQL injection, broken access control, business rules): out of scope for this skill; note it as a gap that needs a human tester or code review.
Mark each finding: Confirmed, False Positive (with the reason), or Needs Human Review. Never "confirm" by attacking.
Phase 4: Score and Prioritise
Score each confirmed finding with CVSS v3.1 (OpenVAPT gives a base vector; adjust only environmental metrics and say why; where a vendor or NVD publishes a CVSS 4.0 vector, quote it too). Prioritise by: exposed to the network and exploitable without login first, then known exploited CVEs (CISA KEV) and a high EPSS probability, then privilege boundaries (root, sudo, SUID), then hardening gaps. Group quick wins (one config line, low risk of breaking things) separately from changes that need a maintenance window. Guidance: references/reporting.md.
Phase 5: Defend by Remediating and Hardening
For each finding, in priority order, using references/defence-playbook.md:
- Explain the fix in plain words: what changes, what could break, how to undo it.
- Back up first (copy the file with its path and a timestamp to a backup folder outside any web root), and validate the new config before applying (
sshd -t,nginx -t,apachectl configtest,visudo -c). - Ask for approval, apply one change, then check the service still works (and for SSH, keep the current session open and test a new login before closing it).
- Record the change and the rollback step.
Never weaken one control to fix another, never disable a check to make it pass, and never lock the user out (firewall and SSH changes always keep a working path in).
Phase 6: Verify the Fix
Re-run the scan with the old report as the baseline:
openvapt scan --baseline <previous>/report.json openvapt diff <previous>/report.json <new>/report.json
A finding is fixed only when the re-scan passes it and the service still works. Anything still failing goes back to Phase 5 or is accepted as a risk in a suppression file with a reason, an owner and an expiry date.
Phase 7: Detect and Monitor
Hardening is not finished until the user would notice an attack. Set up, with approval, the monitoring basics from the defence playbook: auditd rules for identity and privilege files, log retention, failed-login alerting, file integrity monitoring (AIDE), automatic security updates, and a schedule to re-run OpenVAPT (for example weekly via a systemd timer that writes to the user's own report folder). Give the user a short incident first-response card from references/defence-playbook.md.
Phase 8: Report
Produce a report the user can act on (template in references/reporting.md): scope and authorisation statement, method, executive summary, findings table (id, title, severity, CVSS, status), what was fixed with evidence, accepted risks, remaining gaps (including "not a penetration test"), and next steps. Keep it on the machine; the user decides who sees it. Credit OpenVAPT as the licence requires (openvapt cite); show the citation to the user, never post it anywhere yourself.
Output Style
- Plain English, short sentences, Title Case headings; no em or en dashes.
- Every claim backed by evidence you actually saw. Say "designed to" or "reduces risk", never "secure", "safe", "guaranteed" or "compliant".
- When unsure, say so and mark the item Needs Human Review.
Sources
NIST SP 800-115 (technical testing and assessment), NIST CSF 2.0, CIS Controls v8 and CIS Benchmarks, CVSS v3.1 (FIRST), OWASP Top 10, ASVS and WSTG, MITRE CWE and ATT&CK, CISA KEV, NIST SP 800-61 Rev. 3 (incident response), ISO/IEC 27001:2022 Annex A 8.8 (technical vulnerability management), FIRST EPSS. OpenVAPT's own check catalogue cites each source per check: https://openvapt.com/checks/.
Assessment Playbook: Read-Only Manual Checks
These commands are for Linux (Debian, Ubuntu, RHEL, Alma, Rocky, Fedora, SUSE families); paths differ slightly between them and are noted where they matter.
Every command here only reads. Run them on the machine being assessed. Some need root to see everything; if the user runs without root, note the gaps. Never paste secrets, hashes or keys into notes: record the file and line number and write REDACTED.
The matching OpenVAPT check prefix is shown in brackets so you can cross-check with openvapt explain <ID>.
1. System, Inventory and Patches [HOST-OS, HOST-PKG, HOST-UPD, HOST-CVE]
cat /etc/os-release; uname -r # Debian/Ubuntu # Uses the local package lists only; they may be stale until the user runs apt update. apt list --upgradable 2>/dev/null | head -50 # RHEL/Fedora/Alma/Rocky: -C reads the local cache only (no download), which may also be stale dnf -C check-update --security 2>/dev/null | head -50 # Software inventory (CIS Controls 1 and 2): keep a copy with the report dpkg -l 2>/dev/null | wc -l; rpm -qa 2>/dev/null | wc -l # Is the release still supported? Compare with the vendor's end-of-life page.
Look for: end-of-life releases, pending security updates, kernel older than the installed package (reboot pending: needrestart -r l or compare uname -r with the newest installed kernel), automatic updates off.
2. Users, Groups and Privilege [HOST-USR, HOST-SUDO, HOST-PWD, HOST-PAM]
awk -F: '$3==0{print $1}' /etc/passwd # only root should have UID 0
awk -F: '($2==""){print $1}' /etc/shadow # empty passwords (root needed)
getent group sudo wheel admin
sudo -l -U <user> # per user, as root
grep -rhv '^#' /etc/sudoers /etc/sudoers.d/ | grep -E 'NOPASSWD|ALL[[:space:]]*$'
lastlog 2>/dev/null | grep -v 'Never' || lastlog2 2>/dev/null || last -w | head -30
grep -E '^(PASS_MAX_DAYS|PASS_MIN_LEN|UMASK)' /etc/login.defs
grep -rE 'pam_(pwquality|faillock|tally2)' /etc/pam.d/
Look for: extra UID 0 accounts, unused accounts with shells, broad NOPASSWD rules, no lockout after failed logins, weak password policy.
3. SSH [HOST-SSH]
sshd -T 2>/dev/null | grep -Ei '^(permitrootlogin|passwordauthentication|kbdinteractiveauthentication|pubkeyauthentication|permitemptypasswords|maxauthtries|x11forwarding|allowtcpforwarding|ciphers|macs|kexalgorithms|allowusers|allowgroups|loglevel)'
ls -l /etc/ssh/ssh_host_*_key
find /home /root -name authorized_keys -exec ls -l {} \; 2>/dev/null
Look for: root login allowed, password login on an internet-facing host, weak ciphers or MACs, world-readable host keys or authorized_keys, no AllowUsers or AllowGroups.
4. Files and Permissions [HOST-FS]
stat -c '%a %U %n' /etc/passwd /etc/shadow /etc/gshadow /etc/group /etc/crontab find / -xdev -perm -4000 -type f 2>/dev/null # SUID find / -xdev -perm -2000 -type f 2>/dev/null # SGID find / -xdev -type f -perm -0002 2>/dev/null | head # world-writable files find / -xdev -type d -perm -0002 ! -perm -1000 2>/dev/null | head # world-writable dirs without sticky bit findmnt -no TARGET,OPTIONS /tmp /var/tmp /dev/shm
Look for: shadow readable by others, unexpected SUID binaries (check which package owns each one with dpkg -S <file> or rpm -qf <file>; a file no package owns needs a closer look), world-writable paths, /tmp without nodev,nosuid,noexec.
5. Kernel and Boot [HOST-KRN, HOST-BOOT, HOST-MAC]
sysctl kernel.randomize_va_space kernel.kptr_restrict kernel.dmesg_restrict \ kernel.yama.ptrace_scope fs.protected_symlinks fs.protected_hardlinks fs.suid_dumpable \ net.ipv4.ip_forward net.ipv4.conf.all.accept_redirects net.ipv4.conf.all.send_redirects \ net.ipv4.tcp_syncookies net.ipv4.conf.all.rp_filter stat -c '%a %n' /boot/grub*/grub.cfg 2>/dev/null # /boot/grub2 on RHEL getenforce 2>/dev/null; aa-status --enabled 2>/dev/null && echo apparmor-on
6. Services, Timers and Cron [HOST-SVC, HOST-SYSD, HOST-CRON]
systemctl list-units --type=service --state=running --no-pager systemctl list-timers --all --no-pager ls -la /etc/cron.* /var/spool/cron* 2>/dev/null systemd-analyze security --no-pager 2>/dev/null | head -30
Look for: services nobody needs (telnet, rsh, ftp, avahi, cups on servers), cron scripts writable by non-root users, units running as root with no sandboxing.
7. Logging and Audit [HOST-LOG, HOST-AUD, HOST-IDS, HOST-TIME]
systemctl is-active rsyslog systemd-journald auditd chronyd systemd-timesyncd 2>/dev/null auditctl -l 2>/dev/null | head -40 grep -E 'Storage|SystemMaxUse' /etc/systemd/journald.conf timedatectl | grep -i synchronized
8. Containers and Orchestration [HOST-CTR, HOST-DKR, HOST-K8S]
ls -l /var/run/docker.sock 2>/dev/null; getent group docker
docker ps --format '{{.Names}} {{.Image}} {{.Ports}}' 2>/dev/null
docker inspect --format '{{.Name}} priv={{.HostConfig.Privileged}} user={{.Config.User}}' $(docker ps -q) 2>/dev/null
Look for: users in the docker group (equal to root), privileged containers, containers running as root, ports published on 0.0.0.0.
9. Network as Seen From Loopback [NET-LSN, NET-FW, NET-DB, NET-SVC, NET-MAIL, NET-DNS, NET-AI]
ss -tulpn # what listens, on which address (IPv4 and IPv6)
nft list ruleset 2>/dev/null || { iptables -S; ip6tables -S; } 2>/dev/null; ufw status verbose 2>/dev/null
Check IPv6 separately: a service on [::] is reachable over IPv6 even when the IPv4 firewall blocks it, and ufw filters IPv6 only with IPV6=yes. Look for: databases, caches, admin panels or AI model servers (Redis, MongoDB, Elasticsearch, Memcached, MySQL, PostgreSQL, Ollama, Jupyter) bound to 0.0.0.0 or :: without a firewall rule; default-accept firewall policy; an open mail relay configuration. Read the service's config file to confirm authentication is on. Do not connect from another machine and do not try passwords.
TLS on local services (reads the certificate and the offered protocols only):
openssl s_client -connect 127.0.0.1:443 -servername <site-hostname> </dev/null 2>/dev/null | openssl x509 -noout -subject -issuer -dates for p in tls1 tls1_1 tls1_2 tls1_3; do echo -n "$p: "; openssl s_client -connect 127.0.0.1:443 -servername <site-hostname> -$p -cipher 'DEFAULT:@SECLEVEL=0' </dev/null >/dev/null 2>&1 && echo offered || echo no; done
A "no" for TLS 1.0 or 1.1 can also mean the local OpenSSL refuses them; treat it as inconclusive and read the server's ssl_protocols or SSLProtocol setting. Note the certificate's notAfter date: an expiry within 30 days is a finding. [NET-TLS, WEB-TLS]
10. Web, Through Loopback Only [WEB-*]
Always pin the site's name to 127.0.0.1 with --resolve, never let the public name resolve (it may point to another machine or a CDN). --resolve connects only to loopback while sending the right SNI and Host, so name-based sites answer correctly. One GET per path, no parameters, no payloads.
H=<site-hostname>
R="--resolve $H:443:127.0.0.1"
curl -skI $R "https://$H/" | grep -Ei 'server|x-powered-by|strict-transport|content-security|x-frame|x-content-type|referrer-policy|permissions-policy|set-cookie'
for p in .git/HEAD .env .env.bak wp-config.php.bak backup.zip phpinfo.php server-status .DS_Store composer.json; do
printf '%s %s\n' "$(curl -sk $R -o /dev/null -w '%{http_code}' "https://$H/$p")" "$p"
done
Then read the server and app config files rather than probing:
- nginx:
nginx -T 2>/dev/null | grep -E 'server_tokens|autoindex|ssl_protocols|add_header'[WEB-NGX] - Apache:
apachectl -S; grep -rE 'ServerTokens|ServerSignature|Options .*Indexes|TraceEnable' /etc/apache2 /etc/httpd 2>/dev/null[WEB-APA] - PHP: the web server's PHP settings, not the CLI's:
grep -Ei '^(display_errors|expose_php|allow_url_include|session.cookie_(secure|httponly|samesite))' /etc/php/*/fpm/php.ini /etc/php.ini 2>/dev/null(php -ishows only the command-line configuration) [WEB-PHP] - Framework debug: read only the named keys, never the whole file, for example
grep -E '^(APP_DEBUG|APP_ENV|DEBUG|NODE_ENV)=' <app>/.env[WEB-APP, WEB-PY, WEB-NODE] - CMS: core and plugin versions from files on disk, compared with vendor advisories [WEB-CMS, WEB-CVE]
11. Integrity and Stray Secrets [HOST-PKG, HOST-SEC]
debsums -s 2>/dev/null || rpm -Va 2>/dev/null | grep -v '^\.\.\.\.\.\.\.T' | head -40 # changed package files find / -xdev \( -name '.env' -o -name '*.sql' -o -name '*.bak' -o -name '*.key' -o -name 'id_rsa' \) -perm -o=r -type f 2>/dev/null | head ls -l /root/.bash_history /home/*/.bash_history 2>/dev/null
Report only the path and the permission problem. Never open, print or copy the contents.
What This Playbook Does Not Do
No SQL injection, XSS, authentication bypass, IDOR or business logic testing; no port scanning of other hosts; no password checks against live services. List these as gaps that need an authorised human tester or a code review.
Defence Playbook: Remediate, Harden, Detect, Respond
Every change here modifies the machine, and some steps (package updates, certificate renewal, image scanners) download from the internet, so say so before running them. Every change needs the user's approval first. The pattern is always the same:
- Back up: copy the file, keeping its path, to a backup folder outside any web root, for example
sudo install -d -m 700 /root/vapt-backups/$(date -u +%Y%m%dT%H%M%SZ)thensudo cp -a --parents /etc/ssh/sshd_config <that folder>/. - Change one thing.
- Validate before reload (
sshd -t,nginx -t,apachectl configtest,visudo -c,nft -c -f <file>). - Reload and test that the service still works.
- Record the change and how to undo it (copy the backup back and reload).
Never lock the user out: before SSH or firewall changes, keep the current session open, add an allow rule for the user's own access first, and test a fresh login before closing anything. For remote-only machines, suggest a timed rollback (for example at now + 5 minutes restoring the old ruleset) that the user cancels after testing.
1. Patching First
- Debian/Ubuntu:
sudo apt update && sudo apt upgrade; enableunattended-upgradesfor security updates. - RHEL family:
sudo dnf upgrade --security; enablednf-automaticwithupgrade_type = security. - Reboot when the kernel or libc changed (agree the time). End-of-life release: plan an upgrade; no config change fixes it.
2. Accounts and Privilege
- Lock unused accounts:
sudo usermod -L -s /usr/sbin/nologin <user>. - Remove extra UID 0 accounts (after checking what uses them).
- Narrow sudo: replace
ALL=(ALL) NOPASSWD: ALLwith the specific commands needed; edit only withvisudo -f /etc/sudoers.d/<file>. - Lockout and password quality: never hand-edit
/etc/pam.d(a mistake can lock everyone out, and on RHEL authselect overwrites hand edits). RHEL family:sudo authselect enable-feature with-faillock, then setdeny = 5andunlock_time = 900in/etc/security/faillock.conf. Debian and Ubuntu: set the same in/etc/security/faillock.conf; these systems ship no faillock profile forpam-auth-update, so faillock needs a local profile in/usr/share/pam-configs/(check thatpam-auth-updatethen lists it) before it takes effect. If unsure, leave lockout to fail2ban and say so. Password quality:minlen = 14in/etc/security/pwquality.conf. Keep a root session open and test a fresh login before closing it. - Remove users from the
dockergroup unless they need root-equivalent access.
3. SSH
sshd uses the first value it reads, and drop-in files load in name order, so use /etc/ssh/sshd_config.d/01-hardening.conf (a cloud image's 50-cloud-init.conf can otherwise re-enable passwords). Check that the main /etc/ssh/sshd_config has Include /etc/ssh/sshd_config.d/*.conf near the top; if not (older releases such as RHEL 8), edit the main file instead. sshd_config does not allow comments at the end of a line, so comments go on their own line.
PermitRootLogin no # Only after a working key login is confirmed: PasswordAuthentication no KbdInteractiveAuthentication no PermitEmptyPasswords no # 4 leaves room for an SSH agent that offers several keys: MaxAuthTries 4 X11Forwarding no # Unless port forwarding is needed: AllowTcpForwarding no # Create the group and add the real users first: AllowGroups ssh-users LogLevel VERBOSE
sudo sshd -t && sudo systemctl reload ssh (the unit is sshd on the RHEL family). Confirm the effective values with sudo sshd -T | grep -Ei 'permitrootlogin|passwordauthentication|allowgroups', then test a new login in a second terminal. On Ubuntu 24.04 and later sshd may be socket-activated (ssh.socket); a Port change there needs sudo systemctl daemon-reload && sudo systemctl restart ssh.socket. Optional: add multi-factor login (for example a FIDO2 sk- key or a TOTP PAM module) for internet-facing hosts.
4. Network Exposure and Firewall
- Bind internal services to loopback in their own config (Redis
bind 127.0.0.1 ::1andprotected-mode yes; MySQL/MariaDBbind-address = 127.0.0.1; PostgreSQLlisten_addresses = 'localhost'; MongoDBbindIp: 127.0.0.1; Elasticsearchnetwork.host: 127.0.0.1; OllamaOLLAMA_HOST=127.0.0.1), and turn authentication on. - Default-deny inbound, allow only what is needed. With ufw: read the real SSH port first (
sudo sshd -T | grep ^port), thensudo ufw default deny incoming; sudo ufw allow <ssh-port>/tcp; sudo ufw allow 443/tcp; sudo ufw enable(it asks for confirmation). Make sureIPV6=yesin/etc/default/ufwso IPv6 is filtered too. - RHEL, Alma, Rocky and Fedora use firewalld; do not install ufw beside it.
sudo firewall-cmd --permanent --add-service=ssh(or--add-port=<ssh-port>/tcp),sudo firewall-cmd --permanent --add-service=https,sudo firewall-cmd --reload, then check withsudo firewall-cmd --list-all. The default zone already rejects anything not listed. - Docker publishes ports through its own iptables chains, which bypass ufw and firewalld INPUT rules. Publish such ports on
127.0.0.1:or filter them in theDOCKER-USERchain. With nftables, keep the ruleset in/etc/nftables.confand check it withnft -c -ffirst. - Disable services nobody uses:
sudo systemctl disable --now <unit>(confirm with the user what each one does first).
5. Kernel and Filesystem
Kernel settings go in /etc/sysctl.d/60-hardening.conf:
kernel.randomize_va_space = 2 kernel.kptr_restrict = 2 kernel.dmesg_restrict = 1 kernel.yama.ptrace_scope = 1 fs.protected_symlinks = 1 fs.protected_hardlinks = 1 fs.suid_dumpable = 0 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.all.rp_filter = 1 net.ipv4.tcp_syncookies = 1 net.ipv4.conf.default.accept_redirects = 0 net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.default.accept_redirects = 0
rp_filter = 1 can break hosts with several network interfaces or asymmetric routing; use 2 (loose) there. On servers with static IPv6 addresses also consider net.ipv6.conf.all.accept_ra = 0. net.ipv4.ip_forward = 0 only if the host is not a router or container host (Docker and Kubernetes need forwarding). Apply with sudo sysctl --system.
- Permissions: restore the distribution default rather than guessing.
/etc/shadowis640 root:shadowon Debian, Ubuntu and SUSE but000 root:rooton the RHEL and Fedora family; compare withrpm -V setup(RHEL) ordpkg-statoverride --listfirst. GRUB configchmod 600(/boot/grub/grub.cfg, or/boot/grub2/grub.cfgon RHEL); remove world-write bits found in the assessment, remove SUID from binaries that do not need it (chmod u-s, after checking the package owner withdpkg -Sorrpm -qf). - Mount
/tmpand/dev/shmwithnodev,nosuid,noexecwhere the software allows (noexecon/tmpcan break package maintainer scripts and some installers; test an update afterwards). - Disable unused kernel modules in
/etc/modprobe.d/blacklist-vapt.conf(install cramfs /bin/false, the same fordccp,sctp,rds,tipc, andusb-storageon servers without USB use); set* hard core 0in/etc/security/limits.conf; restrict cron and at with/etc/cron.allowand/etc/at.allow(an allow file blocks every user not listed, so first list who has a crontab withsudo ls /var/spool/cron/crontabs /var/spool/cron 2>/dev/nulland add them); set a login banner in/etc/issue.netif the organisation requires one.
6. Web Servers and Applications
- nginx:
server_tokens off; autoindex off; ssl_protocols TLSv1.2 TLSv1.3;and security headers (Strict-Transport-Security "max-age=31536000", addingincludeSubDomainsonly when every subdomain serves HTTPS;X-Content-Type-Options nosniff;Referrer-Policy strict-origin-when-cross-origin; aContent-Security-Policybuilt for the site that includesframe-ancestors 'self', orX-Frame-Options SAMEORIGIN). - Apache:
ServerTokens Prod,ServerSignature Off,TraceEnable Off,Options -Indexes,SSLProtocol -all +TLSv1.2 +TLSv1.3, same headers viamod_headers. - Deny dotfiles and backups: nginx
location ~ /\.(?!well-known) { deny all; }; remove stray backups andphpinfo.phpfrom the web root (move them to a backup folder outside the web root rather than deleting). - PHP:
expose_php = Off,display_errors = Off,allow_url_include = Off, session cookiesSecure,HttpOnly,SameSite=Lax. - Frameworks: production mode (
APP_DEBUG=false,DEBUG = False,NODE_ENV=production); env files outside the web root, mode 600. - CMS: update core, plugins and themes; remove unused ones; disable file editing from the admin panel.
- TLS certificates: automatic renewal (certbot timer), no expired or self-signed certificate on a public site.
7. Mandatory Access Control
Keep SELinux (RHEL family) or AppArmor (Debian, Ubuntu, SUSE) enforcing. SELinux: getenforce; if it is Permissive, review denials first with sudo ausearch -m avc -ts recent and fix labels (restorecon) or write a reviewed local policy (audit2allow), then sudo setenforce 1 and SELINUX=enforcing in /etc/selinux/config. AppArmor: sudo aa-status; move profiles from complain to enforce with aa-enforce after checking the logs. Never disable either to make an application work.
8. Containers
Run containers as a non-root user, never --privileged, publish ports on 127.0.0.1: when only a local proxy needs them, set read_only: true and no-new-privileges:true where possible, keep images updated and pinned by digest, and scan images for known vulnerabilities with a local scanner the user chooses (for example Trivy or Grype, run on this machine).
9. Detection and Monitoring
- auditd rules (
/etc/audit/rules.d/50-vapt.rules):
-w /etc/passwd -p wa -k identity -w /etc/shadow -p wa -k identity -w /etc/group -p wa -k identity -w /etc/sudoers -p wa -k privilege -w /etc/sudoers.d/ -p wa -k privilege -w /etc/ssh/sshd_config -p wa -k sshd -a always,exit -F arch=b64 -S execve -F euid=0 -F auid>=1000 -F auid!=unset -k root-exec -a always,exit -F arch=b32 -S execve -F euid=0 -F auid>=1000 -F auid!=unset -k root-exec
Load with sudo augenrules --load (if the existing rules end with -e 2, the rule set is locked and the new rules apply only after a reboot); review with ausearch -k identity -ts today.
- Persistent journal with a size cap (
Storage=persistent,SystemMaxUse=1G); time sync on. - File integrity:
aide --init, move the new database into place, scheduleaide --check. - Failed logins: review
journalctl -u ssh -u sshd --since today | grep -i failed; fail2ban for SSH on internet-facing hosts. - Scheduled re-assessment: a weekly systemd user timer that runs
openvapt scan --baseline <last report.json>as the user who accepted the terms, writing to the default~/openvapt-reports/(mode 700) on the machine. A user timer stops when the user logs out unlesssudo loginctl enable-linger <user>is set, and without root some checks report coverage gaps; say both. - Central logging: sending logs to another machine helps detect tampering, but it sends data off this machine, so it is the user's decision; describe the trade-off and let them choose.
- Backups: confirm that backups of data and configuration exist, are kept off the machine by the user's own choice, and that a test restore works. Hardening does not help if a disk or ransomware event loses everything.
Incident First Response
If the assessment finds signs of compromise (unknown UID 0 user, unknown SSH key, unexpected SUID binary, an unknown process listening, web shell names in the web root, cron entries nobody recognises):
- Stop changing things. Do not "clean up"; that destroys evidence. Do not reboot: memory and live connections are lost.
- Tell the user plainly what was seen and why it matters.
- Preserve: first capture volatile state (
date -u,ss -tupan,ps auxww,who,last -w | head) to a file; then copy (do not move) relevant logs and the suspicious files' metadata (stat,sha256sum) to a folder outside the web root. Keep a chain-of-custody note: who collected what, when (UTC), from where, and the hash of each copy. - Contain with approval: isolate the machine from the network at the provider or firewall level, rotate credentials from a clean machine.
- Escalate: the user's incident response team, hosting provider or a qualified responder; national CERT/CSIRT if required by law. Follow NIST SP 800-61 Rev. 3 (incident response aligned with CSF 2.0).
- Rebuild from known-good media is usually safer than repairing a compromised host.
Scoring, Prioritising and Reporting
Scoring With CVSS
OpenVAPT gives each check a base vector. Keep the base score; adjust only the environmental metrics (Confidentiality, Integrity and Availability Requirements, and Modified Attack Vector when, for example, a service is reachable only on loopback) and write one line on why. Severity bands: 0.1-3.9 Low, 4.0-6.9 Medium, 7.0-8.9 High, 9.0-10.0 Critical. Calculator: https://www.first.org/cvss/calculator/3.1. CVSS 4.0 (FIRST, 2023) is now published by NVD and many vendors; when a 4.0 vector exists for a CVE, quote it next to the 3.1 score rather than replacing it. EPSS (FIRST) gives the probability that a CVE is exploited in the next 30 days; use it with the CISA KEV catalogue to rank CVEs.
Remediation Deadlines
ISO/IEC 27001:2022 Annex A 8.8 expects timely remediation. Suggest, and let the user set: Critical within 7 days, High within 30 days, Medium within 90 days, Low at the next maintenance window. Anything in CISA KEV is treated as Critical. Record the agreed date with each finding.
Priority Order
- Reachable from the network without login (exposed database, admin panel, debug mode,
.gitor.envserved). - Known exploited vulnerabilities (in the CISA KEV catalogue, or a high EPSS score) and end-of-life software.
- Privilege boundaries: extra root accounts, broad sudo, SUID, docker group, root containers.
- Authentication strength: SSH passwords, no lockout, weak password policy.
- Hardening and defence in depth: sysctl, headers, banners, permissions.
- Detection gaps: logging, audit, monitoring.
Within each band, put quick wins (one line, low break risk) first.
Finding Record
ID: <OpenVAPT check id, or MANUAL-<area>-<n>> Title: <Title Case> Status: Confirmed | False Positive | Needs Human Review | Fixed | Accepted Risk Severity: <band> (CVSS 3.1 <score>, <vector>) Evidence: <file:line or command and the relevant output, secrets REDACTED> Impact: <one or two plain sentences> Fix: <the change> Rollback: <how to undo> Due: <agreed remediation date> Verified: <re-scan result, date> References: <CWE, CIS, OWASP, vendor advisory>
Report Template
# Vulnerability Assessment and Hardening Report: <hostname> ## Scope and Authorisation <scope record from Phase 0> ## Method OpenVAPT <version> automated read-only scan, manual read-only verification (playbook areas covered), CVSS v3.1 scoring. Based on NIST SP 800-115 assessment techniques. Not a penetration test. ## Executive Summary <3 to 5 sentences: overall state, the most important risks, what was fixed, what remains> ## Findings | ID | Title | Severity | CVSS | Status | |----|-------|----------|------|--------| ## Fixed in This Engagement <each fix with evidence from the re-scan and the openvapt diff output> ## Accepted Risks <id, reason, owner, expiry date> ## Gaps and Limitations Application logic, authentication flows and other hosts were not tested. Automated checks can miss issues and can be wrong. This report reflects the machine at the time of the scan only. ## Next Steps <prioritised list with suggested dates; re-assessment schedule> ## Credit <output of `openvapt cite`>
Wording Rules
Say "reduces the risk of", "designed to", "no finding at the time of the scan". Never say secure, safe, compliant, certified, guaranteed or "passed a penetration test". Keep the report on the machine; the user decides who may read it, because a vulnerability report is sensitive.