T09 · Insecure Skill Coding Practices
- Location
references/common-fixes.md:6- Finding
Privileged remediation commands can cause lockout, service disruption, or unsafe system-wide configuration changes
- Content
View full analysis
Vulnerability Details
File Location:
references/common-fixes.md, lines 6–30, 35–51, 76–79, and 100–124
Vulnerability Type: Unsafe privileged remediation guidance
Risk Level: MediumComplete Code Snippets
bash sudo sed -i 's/#*PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config sudo systemctl restart sshdbash sudo sed -i 's/#*PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config sudo systemctl restart sshdbash sudo sed -i 's/#*MaxAuthTries.*/MaxAuthTries 3/' /etc/ssh/sshd_config sudo systemctl restart sshdbash sudo sed -i 's/#*Port .*/Port 2222/' /etc/ssh/sshd_config sudo ufw allow 2222/tcp sudo systemctl restart sshd # Then: sudo ufw delete allow 22/tcpbash sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow ssh sudo ufw allow http sudo ufw allow https sudo ufw enablebash sudo apt install fail2ban -y sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local sudo sed -i 's/bantime = 10m/bantime = 1h/' /etc/fail2ban/jail.local sudo systemctl enable fail2ban sudo systemctl start fail2banbash sudo mount -o remount,noexec,nosuid /tmpbash cat >> /etc/sysctl.d/99-hardening.conf << 'EOF' net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1 net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.conf.all.accept_redirects = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.default.accept_source_route = 0 kernel.randomize_va_space = 2 fs.suid_dumpable = 0 EOF sudo sysctl --systemTechnical Analysis
The Skill presents commands as copy-paste remediations even though they make immediate, system-wide changes with elevated privileges. The instructions do not require ...[truncated 3170 chars]
- Remediation
View remediation
Remediation Suggestions
- Clearly label all commands as environment-dependent examples rather than universally safe copy-paste fixes.
- Require explicit user confirmation before installation, service enablement, firewall activation, SSH restart, mount modification, or kernel-setting changes.
- Back up each affected configuration file with ownership and permissions preserved before editing it.
- Validate SSH configuration with
sudo sshd -tbefore reloading it. Preferreloadoverrestartwhere supported. - Keep an existing privileged SSH session open and verify a second key-authenticated connection before disabling passwords, root access, or port 22.
- Inventory required inbound ports and use firewall dry-run or staged rules before enabling a default-deny policy.
- Check whether Fail2ban is already installed and review its effective jail configuration before enabling persistent startup.
- Assess application and distribution compatibility before changing
/tmpmount options; make the change temporary and reversible during testing. - Write privileged files through
sudo teerather than relying on shell redirection, and replace managed configuration atomically instead of repeatedly appending values. - Validate sysctl settings individually and record previous values so they can be restored.
- Include explicit verification and rollback commands for every remediation.
