System and network
The base group (33 checks) covers machine, process, cron, systemd, user, SSH-agent and shell-history commands; the network group (22 checks) covers firewalls, routes, interfaces, reverse shells and destructive HTTP and GraphQL API calls.
Two groups protect the machine you are logged in to:
base(33 checks): reboot and shutdown, killing processes, cron, systemd, users and passwords, Windows shadow copies and Defender, the SSH agent andknown_hosts, clearing or turning off shell history, emptying system logs. It includes theprocess:*,ssh:*andsystemd:*id prefixes.network(22 checks): firewall rules and the firewall service, routes, interfaces and addresses, reverse shells, and HTTPDELETErequests and GraphQL mutations that delete something through an API.
Many of these are lock-outs: on a remote server, a firewall rule or a stopped network can cut off the SSH session you would use to fix it. Over SSH the context is elevated, so the challenge is at least Math. See SSH and root.
Examples
shellfirm check -c 'iptables -F'1 risky pattern(s) matched:
[network:flush_iptables] [CRITICAL] This flushes all firewall rules.
Shell (you, in a terminal): would challenge (Yes, escalated from Math: severity CRITICAL)
AI agent (hooks, MCP): deny (blocked)
why: Severity CRITICAL meets or exceeds agent auto-deny threshold HIGHshellfirm check -c 'kill -9 -1'2 risky pattern(s) matched:
[process:kill_init_or_all] [CRITICAL] This signals PID 1 (init, or a container's main process) or every process you own (-1): it can halt the machine or end your whole session.
[process:kill_9] [LOW] SIGKILL gives no chance for graceful shutdown or cleanup.
> Safe alternative: kill <pid> (Send SIGTERM first to allow graceful shutdown, then kill -9 if needed.)
Shell (you, in a terminal): would challenge (Yes, escalated from Math: severity CRITICAL)
AI agent (hooks, MCP): deny (blocked)
why: Severity CRITICAL meets or exceeds agent auto-deny threshold HIGHMachine, processes and services (base)
Machine
| Check id | Severity | What it catches |
|---|---|---|
base:bash_fork_bomb | Critical | This short line defines a shell function that creates new copies of itself. The process continually replicates itself, and its copies continually replicate themselves, quickly taking up all your CPU time and memory. This can cause your computer to freeze. It's basically a denial-of-service attack. |
base:execute_all_history_commands | Critical | This re-runs every command in your shell history. |
base:reboot_machine | High | This reboots the machine. |
base:shutdown_machine | High | This shuts down the machine. |
base:clear_history | Medium | This erases your shell history, including the record of what was run. |
base:disable_history | Medium | This turns off your shell history, so the commands that follow leave no record. |
base:poweroff_machine | High | This powers off the machine immediately. |
base:init_shutdown_reboot | High | This shuts down (init 0) or reboots (init 6) the machine. |
base:sysrq_trigger | Critical | This runs a kernel SysRq action immediately (b reboots, o powers off, c crashes the kernel), without a clean shutdown. |
base:remount_root_readonly | High | This remounts the root filesystem read-only: services that write to disk start failing. |
base:journal_vacuum | Medium | This permanently deletes archived system journal logs. |
base:delete_shadow_copies | Critical | This deletes the Windows shadow copies or backups (System Restore, previous versions of files): nothing is left to restore from. |
base:delete_backups_macos | Critical | This deletes Time Machine backups or local APFS snapshots: there is nothing left to restore the files from. |
base:disable_antivirus | High | This turns off Windows Defender protection or excludes a path, process or file type from scanning. |
base:clear_event_logs | High | This clears the Windows event logs, erasing the record of what happened on the machine. |
base:disable_macos_security | High | This disables a core macOS protection — System Integrity Protection (csrutil) or Gatekeeper (spctl) — letting unsigned or tampered code run. |
base:clear_history_file | Medium | This deletes or empties your shell history file, erasing the record of the commands run before. |
base:wipe_system_logs | High | This empties system log files under /var/log, erasing the record of logins and of what ran on the machine. |
Processes (process:*)
| Check id | Severity | What it catches | Safe alternative |
|---|---|---|---|
process:kill_init_or_all | Critical | This signals PID 1 (init, or a container's main process) or every process you own (-1): it can halt the machine or end your whole session. | |
process:kill_9 | Low | SIGKILL gives no chance for graceful shutdown or cleanup. | kill <pid> |
process:killall | Medium | This kills every process with that name. | |
process:pkill | Medium | This kills every process matching the pattern, which can include unintended ones. |
Services (systemd:*) and cron
| Check id | Severity | What it catches | Safe alternative |
|---|---|---|---|
base:delete_all_cron_tasks | High | This removes all of your cron jobs. | |
base:crontab_replace | Medium | This replaces your whole crontab with this input: every existing cron job not in it is removed, and the new ones run on a schedule from now on. | crontab -l > crontab.backup |
systemd:disable_service | Medium | Disabling or masking a service prevents it from starting on boot. | |
systemd:stop_critical_service | High | Stopping a critical system service can cause outages. | |
base:systemctl_enable | Low | This makes a service start automatically at every boot or login. | |
systemd:isolate_rescue | High | This switches the machine to single-user / emergency mode (or halts it): every other service stops, including the network and SSH. |
Users and SSH
| Check id | Severity | What it catches |
|---|---|---|
ssh:delete_all_identities | Medium | This removes all identities from the SSH agent. |
ssh:remove_known_host | Low | Removes a host from known_hosts — could enable MITM attacks. |
base:userdel_remove_home | High | This deletes the user together with their home directory and mail spool. |
base:passwd_delete | High | This removes the account's password: it can then log in without one. |
base:lock_root_account | High | This locks the root account's password: without another administrator login you can lock yourself out. |
Network (network)
| Check id | Severity | What it catches | Safe alternative |
|---|---|---|---|
network:flush_iptables | Critical | This flushes all firewall rules. | |
network:delete_custom_chains | High | This deletes all custom firewall chains. | |
network:flush_nat_rules | High | This flushes all NAT rules. | |
network:disable_firewall | Critical | This disables the firewall. | |
network:disable_firewall_windows | Critical | This turns the Windows firewall off, leaving every port open. | |
network:force_reset_firewall | Critical | This resets the firewall: every rule is removed and the firewall is disabled. | |
network:stop_networking | High | This stops the networking service. | |
network:stop_network_manager | High | This stops NetworkManager. | |
network:bring_down_interface | High | This brings a network interface down. | |
network:bring_down_interface_ip | High | This brings a network interface down. | |
network:delete_default_route | High | This deletes the default network route. | |
network:flush_nftables | Critical | Flushing all nftables rules removes all firewall protection. | |
network:flush_routes | Critical | Flushing the routing table causes immediate loss of network connectivity. | |
network:iptables_default_drop | High | This sets the default firewall policy to DROP, which can cut off all traffic, including your SSH session. | |
network:iptables_drop_all_input | High | This appends a catch-all DROP/REJECT rule to INPUT, dropping all incoming traffic including your SSH session. | |
network:reverse_shell | High | This opens a reverse shell: it hands an interactive shell on this machine to whoever listens at the remote address. | |
network:flush_addresses | High | This removes the IP addresses of a network interface: the machine (and your SSH session) loses connectivity on it. | |
network:ufw_default_deny | High | This makes the firewall refuse all incoming connections by default, including SSH unless a rule allows it. | ufw allow OpenSSH |
network:stop_firewall | High | This turns the firewall off: every listening port becomes reachable from the network. | |
network:http_delete_authenticated | High | This sends an authenticated HTTP DELETE request: the API deletes the resource at that URL (a project, repository, database, volume, ...) with your credentials. | curl -X GET <url> |
network:http_delete | Medium | This sends an HTTP DELETE request: the server deletes the resource at that URL. | curl -X GET <url> |
network:graphql_destructive_mutation | High | This sends a GraphQL mutation that deletes or archives something (a project, repository, volume, service, ...) through the API. | query the object first |
Stopping or disabling the firewall service is High (network:stop_firewall): systemctl stop firewalld, service ufw stop, socketfilterfw --setglobalstate off / =off, unloading com.apple.alf, pfctl -d. ufw --force disable is Critical, like ufw disable. Turning shell history off is Medium (base:disable_history): unset HISTFILE, export HISTFILE=/dev/null, HISTSIZE=0, set +o history, shopt -u -o history; so is deleting or emptying the history file (rm ~/.bash_history, > ~/.zsh_history, base:clear_history_file). Emptying system logs (truncate -s 0 /var/log/auth.log, : > /var/log/syslog) is High (base:wipe_system_logs). All are common first steps before something that should leave no trace.
Destructive API calls
A delete sent straight to an API with curl, http (HTTPie) or wget skips every CLI check above it. shellfirm recognises the two forms that show on the command line:
shellfirm check -c 'curl -X DELETE -H "Authorization: Bearer $TOKEN" https://api.example.com/v1/projects/42'1 risky pattern(s) matched:
[network:http_delete_authenticated] [HIGH] This sends an authenticated HTTP DELETE request: the API deletes the resource at that URL (a project, repository, database, volume, ...) with your credentials.
> Safe alternative: curl -X GET <url> (Fetch the resource first and check it is the one to delete.)
Shell (you, in a terminal): would challenge (Math)
AI agent (hooks, MCP): deny (blocked)
why: Severity HIGH meets or exceeds agent auto-deny threshold HIGH| Line | Result |
|---|---|
curl -X DELETE with -H "Authorization: …" or -u, http DELETE … Authorization:…, http -a user:pw DELETE …, xh --bearer T DELETE …, wget --method=DELETE --header=… | High (network:http_delete_authenticated); an AI agent is denied |
| The same without credentials on the line | Medium (network:http_delete); an AI agent is asked |
A DELETE to a local development server (localhost, 127.0.0.1, [::1], *.localhost, host.docker.internal, the httpie :3000/… shorthand) | Not matched, unless the path starts with _ or holds a * (localhost:9200/_all) |
A GraphQL mutation with a top-level field that deletes or archives something (volumeDelete(…), deleteRepository(…), delete_users(…), archiveRepository(…)), sent with curl, http, wget or gh api graphql | High (network:graphql_destructive_mutation). Every top-level field is read, stepping over arguments and string literals (also JSON-escaped ones), so a ) in an issue title does not hide a later field, and a mutation written inside a comment body is not one. When a string or bracket is left open, every name after mutation counts |
A GraphQL query, a relationship edit (removeLabelsFromLabelable, removeStar, issueRemoveLabel), or a mutation sent to a local server | Not matched |
A request body read from a file, a pipe or a heredoc (curl -d @mutation.json, echo … | curl -d @-), a URL-encoded query, or a POST to a delete endpoint | Not matched: the line does not show what it does |
The firewall false positive
Hardening a firewall the right way, ufw allow OpenSSH && ufw default deny incoming, is still treated as a possible lock-out (High; an AI agent is denied), because shellfirm checks ufw default deny on its own:
[network:ufw_default_deny] [HIGH] This makes the firewall refuse all incoming connections by default, including SSH unless a rule allows it.
> Safe alternative: ufw allow OpenSSH (Allow SSH first (then set the default policy), so the session that changes the firewall is not cut off.)Run the two commands one at a time, or approve the challenge.
Not covered yet
- Lock-outs beyond locking the root account: locking or removing other users, and firewall rules that drop only the SSH port.
- Reverse shells in uncommon spellings. Only the common ones are recognised.
- Destructive API calls whose request is not on the line: a body read from a file, a pipe or a heredoc (
curl -d @mutation.json,echo … | curl -d @-), a URL-encoded query, or aPOSTto a delete endpoint. - Calls to a local development server (
localhost,127.0.0.1,*.localhost,host.docker.internal), even when the port is forwarded to a remote service. A path that starts with_or holds a*(localhost:9200/_all) is still checked.
See Known limitations. Reverse shells and credential exfiltration are also described on Remote scripts and exfiltration.
npm
The npm group (4 checks) covers unpublishing and deprecating packages with npm, yarn and pnpm.
Remote scripts and exfiltration
The shell group (15 checks) covers remote scripts run in a shell or an inline interpreter and code shellfirm cannot see; the exfil group (16 checks) covers secrets read, listed, printed or searched for, and credentials, environment variables and shell history sent off the machine.