Sploitus

Exploit for JGD

githubexploit Β· 2026-09-13

Exploit Code

README217 lines
## https://sploitus.com/exploit?id=96CF0386-DDF7-516A-8058-A2E4134E88A6
# ⚑ JGD

### JavaGadgetDigger β€” Solving the Last Mile of Deserialization Vulnerability Discovery

[![Python](https://img.shields.io/badge/Python-3.10+-blue?logo=python&logoColor=white)](https://python.org)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![Java](https://img.shields.io/badge/Java-11%20%7C%2017-orange?logo=java&logoColor=white)](https://openjdk.org)

🌐 **[δΈ­ζ–‡η‰ˆ](README.zh-CN.md)**

---

## What is JGD?

An **autonomous agent** that takes any JAR directory and produces:
1. **Known public chains** β€” four-state determination (PRESENT / VERSION / ASSEMBLE / FIRE)
2. **Novel unpublished chains** β€” discovered via static + dynamic analysis with adversarial LLM auditing
3. **Weaponized PoCs** β€” serialized payloads with RCE closure demo (benign marker file)

All decisions are internalized: `JARs in β†’ chains out`, zero intermediate user input.

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Input: any JAR directory          Output: chains + PoCs        β”‚
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚  Known   │──▢│  Bridge  │──▢│  Chain   │──▢│   PoC    β”‚   β”‚
β”‚  β”‚  Chains  β”‚   β”‚  Discoveryβ”‚  β”‚  Pairing β”‚   β”‚  Weapon  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚       β”‚               β”‚               β”‚               β”‚          β”‚
β”‚   signature       bytecode         dynamic         benign      β”‚
β”‚   + version       + CHA graph      + contract      payload     β”‚
β”‚   gates           + dispatch       synthesis       + fire      β”‚
β”‚                   edges            + 3 carriers    test       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## πŸ†• Discovered Novel Chains

### T1 β€” Novel Entry (ds confirmed: absent from all public corpora)

| Chain | Bridge Class | Carrier | JDK | Status |
|-------|-------------|---------|-----|--------|
| **objlongpair-hashmap** | `org.apache.activemq.artemis.api.core.ObjLongPair` | HashMap rehash | 17+ | βœ… RCE_CLOSED |

```
HashMap.readObject() β†’ rehash β†’ hash(key)
  β†’ ObjLongPair.hashCode() β†’ Objects.hash(first, second)
    β†’ Arrays.hashCode() β†’ first.hashCode()     [Object field β€” isInstance always true]
      β†’ EqualsBean.hashCode() β†’ beanHashCode()
        β†’ ObjectBean.toString() β†’ ToStringBean.toString()
          β†’ Templates.getOutputProperties() β†’ TemplatesImpl.newTransformer()
            β†’ TemplatesImpl.defineClass() β†’ payload static block β†’ RCE
```

> **Novelty**: Entry-side confirmed T1 by adversarial audit β€” absent from ysoserial,
> GadgetInspector, and all public CVE writeups. Orthogonal to all known ROME entry
> paradigms (direct ROME key / BAVE / HotSwappableTargetSource / XString).

### T2 β€” New Carriers (ds confirmed CONFIRM)

| Chain | Bridge Class | Library | Carrier | JDK | Status |
|-------|-------------|---------|---------|-----|--------|
| **mutableobj-bave** | `cn.hutool.core.lang.mutable.MutableObj` | hutool-core | BAVE toString | ≀11 | βœ… RCE_CLOSED |
| **antlr4-pair-bave** | `org.antlr.v4.runtime.misc.Pair` | antlr4-runtime | BAVE toString | ≀11 | βœ… RCE_CLOSED |
| **federationconfiguration-hashmap** | `FederationConfiguration` | Artemis | HashMap rehash | 17+ | βœ… RCE_CLOSED |
| **federationaddresspolicy** | `FederationAddressPolicyConfiguration` | Artemis | HashMap rehash | 17+ | βœ… RCE_CLOSED |
| **federationqueuepolicy** | `FederationQueuePolicyConfiguration` | Artemis | HashMap rehash | 17+ | βœ… RCE_CLOSED |
| **broadcastgroupconfiguration** | `BroadcastGroupConfiguration` | Artemis | HashMap rehash | 17+ | βœ… RCE_CLOSED |

### T3 β€” Variants

| Chain | Bridge Class | Library | Notes |
|-------|-------------|---------|-------|
| **ewah-hashmap** | `EWAHCompressedBitmap` | JavaEWAH (Lucene/ES) | Shallow dispatch, limited value |


πŸ“Š Full dispatch stacks (click to expand)

**ObjLongPair (T1, JDK 17):**
```
HashMap.put β†’ HashMap.hash
  β†’ ObjLongPair.hashCode(ObjLongPair.java:55)
    β†’ Objects.hash β†’ Arrays.hashCode
      β†’ EqualsBean.hashCode β†’ EqualsBean.beanHashCode
        β†’ ObjectBean.toString β†’ ToStringBean.toString β†’ Method.invoke
          β†’ TemplatesImpl.defineClass β†’ payload static block
```

**MutableObj (T2, JDK 11):**
```
BAVE.readObject β†’ val.toString()
  β†’ MutableObj.toString β†’ value.toString()
    β†’ ObjectBean.toString β†’ ToStringBean.toString
      β†’ Templates.getOutputProperties β†’ newTransformer β†’ defineClass β†’ RCE
```


## πŸš€ Quick Start

### CLI Mode (batch audit)

```bash
# Install dependencies (Python 3.10+, JDK 11 & 17, ECJ compiler)
pip install chromadb  # optional, for RAG persistence

# Point at any JAR directory and get chains + PoCs
python3 audit_target.py --target /path/to/jars --name "your-product"
```

### TUI Mode (interactive visualization)

```bash
python3 tui.py                    # English
python3 tui.py --lang zh          # δΈ­ζ–‡
```

### Key Bindings (TUI)

| Key | Action |
|-----|--------|
| `↑` `↓` / `j` `k` | Navigate chains |
| `Enter` | Toggle detail view |
| `t` | Switch language (EN/CN) |
| `q` | Quit |

## πŸ“ Project Structure

```
jgd/
β”œβ”€β”€ audit_target.py          # Product CLI entry point
β”œβ”€β”€ tui.py                   # Interactive TUI
β”œβ”€β”€ jgd/            # Core agent modules (25)
β”‚   β”œβ”€β”€ verify_agent.py      # Bridge discovery + ds adversarial audit
β”‚   β”œβ”€β”€ chain_complete.py    # Chain pairing + exhaustion proof
β”‚   β”œβ”€β”€ poc_gen.py           # Weaponized PoC generation
β”‚   β”œβ”€β”€ known_chains.py      # Public chain four-state determination
β”‚   β”œβ”€β”€ matrix_agent.py      # Multi-JDK probe orchestration
β”‚   β”œβ”€β”€ bcdisasm.py          # Pure-Python bytecode disassembler
β”‚   β”œβ”€β”€ bridge_fix.py        # Operand-stack symbolic execution
β”‚   β”œβ”€β”€ chroma_store.py      # RAG with corpus-scoped collections
β”‚   β”œβ”€β”€ llm.py               # Dual-model (GLM Γ— DeepSeek)
β”‚   β”œβ”€β”€ scope.py             # Corpus fingerprint isolation
β”‚   β”œβ”€β”€ profiler.py          # Node-level performance profiling
β”‚   β”œβ”€β”€ conductor.py         # Acceptance-gated terminal verdict
β”‚   └── ...
β”œβ”€β”€ examples/
β”‚   β”œβ”€β”€ chains.json          # All discovered chains (machine-readable)
β”‚   └── chains.md            # Human-readable chain catalog
β”œβ”€β”€ tests/
β”‚   └── test_smoke.py        # Third-party reproducible test suite
β”œβ”€β”€ ARCHITECTURE.md          # 25-module graph + design decisions
β”œβ”€β”€ CHANGELOG.md             # Design decision history (R6-R52)
β”œβ”€β”€ SECURITY.md              # Authorized-use policy + disclosure
β”œβ”€β”€ CONTRIBUTING.md          # Five development principles
└── LICENSE                  # MIT
```

## πŸ”¬ How It Works

### 1. Public Chain Determination (guaranteed)
- Class signature matching against curated corpus
- Version gates (e.g., CC 3.2.2 blocks functors, CC4 4.6 NotSerializable, BAVE JDK17 narrows val to String)
- Dynamic assembly + fire verification using target's own JARs

### 2. Novel Chain Discovery (domain-exhaustive)
- **Static**: Operand-stack symbolic execution detects receiver-bridges + argument-bridges
- **Graph**: Real-time corpus-fingerprinted call graph + CHA dispatch edges
- **Dynamic**: Batch-parallel JVM probes (3 carriers Γ— field-contract synthesis Γ— multi-JDK)
- **Observability**: Marker reachability + exception stack frames + marker caller-stack capture

### 3. Adversarial Auditing
- **Finder β‰  Verifier**: GLM selects candidates, DeepSeek audits independently
- **DSH acceptance gate**: Terminal verdicts rejected until DS acceptance passes
- **"Claims β‰  Evidence" standard**: Every fix requires measurement evidence

### 4. Weaponized PoC Generation
- Chains auto-derived from mining artifacts (`derive_chains`)
- Field-type-aware bridge assembly (`make_bridge` with Object/interface-Proxy)
- Tail candidate loop until RCE closure (`R42 completeness cycle`)
- Benign payload: writes `/tmp` marker file only

## ⚑ Performance

| Metric | Value |
|--------|-------|
| Full pipeline (31 jars) | ~90s end-to-end |
| Pair throughput | 1500+ pairs / 9 min (batch + 4 workers) |
| PoC generation (3 chains) | 20.3s (2.7Γ— speedup with parallel) |
| Memory per JVM | ≀ 256 MB (-Xmx256m, 28% headroom) |
| OOM count across full corpus | 0 |

## πŸ›‘οΈ Honest Capability Boundaries

| Claim | Status |
|-------|--------|
| Public chains: guaranteed detection | βœ… Mechanical (finite signature set) |
| Novel chains: domain-exhaustive | βœ… Within declared scope (ledger-verifiable) |
| Novel chains: universally exhaustive | ❌ Undecidable (Rice's theorem) |
| PoC: always complete output | βœ… Tail candidate loop until RCE closure |

## πŸ“– Documentation

- [ARCHITECTURE.md](ARCHITECTURE.md) β€” 25-module graph, design decisions
- [CHANGELOG.md](CHANGELOG.md) β€” 47-round evolution history (R6-R52)
- [examples/chains.md](examples/chains.md) β€” Human-readable chain catalog
- [SECURITY.md](SECURITY.md) β€” Authorized-use policy, responsible disclosure

## ⚠️ Disclaimer

For **lawful security research, education, and authorized penetration testing only**.
All PoC payloads write a benign marker file (`/tmp/jgd_poc_fired`) β€” no destructive action.

## πŸ“„ License

[MIT](LICENSE) β€” Copyright (c) 2026 JGD Contributors