Skip to content
$ shellfirm

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 and known_hosts, clearing or turning off shell history, emptying system logs. It includes the process:*, ssh:* and systemd:* id prefixes.
  • network (22 checks): firewall rules and the firewall service, routes, interfaces and addresses, reverse shells, and HTTP DELETE requests 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'
Output
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 HIGH
shellfirm check -c 'kill -9 -1'
Output
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 HIGH

Machine, processes and services (base)

Machine

Check idSeverityWhat it catches
base:bash_fork_bombCriticalThis 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_commandsCriticalThis re-runs every command in your shell history.
base:reboot_machineHighThis reboots the machine.
base:shutdown_machineHighThis shuts down the machine.
base:clear_historyMediumThis erases your shell history, including the record of what was run.
base:disable_historyMediumThis turns off your shell history, so the commands that follow leave no record.
base:poweroff_machineHighThis powers off the machine immediately.
base:init_shutdown_rebootHighThis shuts down (init 0) or reboots (init 6) the machine.
base:sysrq_triggerCriticalThis runs a kernel SysRq action immediately (b reboots, o powers off, c crashes the kernel), without a clean shutdown.
base:remount_root_readonlyHighThis remounts the root filesystem read-only: services that write to disk start failing.
base:journal_vacuumMediumThis permanently deletes archived system journal logs.
base:delete_shadow_copiesCriticalThis deletes the Windows shadow copies or backups (System Restore, previous versions of files): nothing is left to restore from.
base:delete_backups_macosCriticalThis deletes Time Machine backups or local APFS snapshots: there is nothing left to restore the files from.
base:disable_antivirusHighThis turns off Windows Defender protection or excludes a path, process or file type from scanning.
base:clear_event_logsHighThis clears the Windows event logs, erasing the record of what happened on the machine.
base:disable_macos_securityHighThis disables a core macOS protection — System Integrity Protection (csrutil) or Gatekeeper (spctl) — letting unsigned or tampered code run.
base:clear_history_fileMediumThis deletes or empties your shell history file, erasing the record of the commands run before.
base:wipe_system_logsHighThis empties system log files under /var/log, erasing the record of logins and of what ran on the machine.

Processes (process:*)

Check idSeverityWhat it catchesSafe alternative
process:kill_init_or_allCriticalThis 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_9LowSIGKILL gives no chance for graceful shutdown or cleanup.kill <pid>
process:killallMediumThis kills every process with that name.
process:pkillMediumThis kills every process matching the pattern, which can include unintended ones.

Services (systemd:*) and cron

Check idSeverityWhat it catchesSafe alternative
base:delete_all_cron_tasksHighThis removes all of your cron jobs.
base:crontab_replaceMediumThis 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_serviceMediumDisabling or masking a service prevents it from starting on boot.
systemd:stop_critical_serviceHighStopping a critical system service can cause outages.
base:systemctl_enableLowThis makes a service start automatically at every boot or login.
systemd:isolate_rescueHighThis switches the machine to single-user / emergency mode (or halts it): every other service stops, including the network and SSH.

Users and SSH

Check idSeverityWhat it catches
ssh:delete_all_identitiesMediumThis removes all identities from the SSH agent.
ssh:remove_known_hostLowRemoves a host from known_hosts — could enable MITM attacks.
base:userdel_remove_homeHighThis deletes the user together with their home directory and mail spool.
base:passwd_deleteHighThis removes the account's password: it can then log in without one.
base:lock_root_accountHighThis locks the root account's password: without another administrator login you can lock yourself out.

Network (network)

Check idSeverityWhat it catchesSafe alternative
network:flush_iptablesCriticalThis flushes all firewall rules.
network:delete_custom_chainsHighThis deletes all custom firewall chains.
network:flush_nat_rulesHighThis flushes all NAT rules.
network:disable_firewallCriticalThis disables the firewall.
network:disable_firewall_windowsCriticalThis turns the Windows firewall off, leaving every port open.
network:force_reset_firewallCriticalThis resets the firewall: every rule is removed and the firewall is disabled.
network:stop_networkingHighThis stops the networking service.
network:stop_network_managerHighThis stops NetworkManager.
network:bring_down_interfaceHighThis brings a network interface down.
network:bring_down_interface_ipHighThis brings a network interface down.
network:delete_default_routeHighThis deletes the default network route.
network:flush_nftablesCriticalFlushing all nftables rules removes all firewall protection.
network:flush_routesCriticalFlushing the routing table causes immediate loss of network connectivity.
network:iptables_default_dropHighThis sets the default firewall policy to DROP, which can cut off all traffic, including your SSH session.
network:iptables_drop_all_inputHighThis appends a catch-all DROP/REJECT rule to INPUT, dropping all incoming traffic including your SSH session.
network:reverse_shellHighThis opens a reverse shell: it hands an interactive shell on this machine to whoever listens at the remote address.
network:flush_addressesHighThis removes the IP addresses of a network interface: the machine (and your SSH session) loses connectivity on it.
network:ufw_default_denyHighThis makes the firewall refuse all incoming connections by default, including SSH unless a rule allows it.ufw allow OpenSSH
network:stop_firewallHighThis turns the firewall off: every listening port becomes reachable from the network.
network:http_delete_authenticatedHighThis 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_deleteMediumThis sends an HTTP DELETE request: the server deletes the resource at that URL.curl -X GET <url>
network:graphql_destructive_mutationHighThis 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'
Output
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
LineResult
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 lineMedium (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 graphqlHigh (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 serverNot 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 endpointNot 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:

Output
  [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 a POST to 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.