File size: 3,685 Bytes
ec47cae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
license: cc-by-4.0
language:
- en
tags:
- cybersecurity
- reverse-engineering
- mobile
pretty_name: WiREBench
size_categories:
- n<1K
---
# Benchmark

A benchmark for evaluating AI/LLM agents at reverse-engineering encryption
protocols used by Android mobile applications. Each task provides a decompiled
Android app and captured network traffic; the goal is to identify the cipher,
extract the key material, and produce a working encryption implementation that
can decrypt the captured ciphertexts.

## Directory layout

```
benchmark/
├── common/                        # Shared resources (not a task) for all runs
│   ├── audit_schema.json          # JSON Schema for audit.json output
│   ├── encrypt_template.py        # Starter template for encrypt.py
│   └── pyproject.toml             # encrypt.py dependencies (pycryptodome, jsonschema, cramjam)

└── <task-name>/                   # One directory per benchmark task
    ├── metadata.json             # Machine-readable metadata about this protocol and APK
    ├── README.md                 # High-level description of protocol and vulnerability.
    ├── input/
    │   ├── traces/               # Network packet captures
    │   │   └── *.pcapng
    │   ├── ciphertexts.json      # Annotatied packets from traces/
    │   └── jadx-output/          # Empty folder for pre-decompiled app source tree

    └── expected_output/          # -- Ground truth (for scoring) --
        ├── audit.json            # Task 1: cryptography specification
        ├── plaintexts.json       # Task 2: PoC decryption from ciphertexts.json
        └── encrypt.py            # Task 3: Reference encryption re-implementation
```

## File formats

### `input/ciphertexts.json`

Array of ciphertext samples captured from network traffic.

```json
[
  {
    "file": "input/traces/com.example.app.pcapng",
    "packet_number": 463,
    "ciphertext": "b31e48f9a23dcf1d...",
    "encoding": "hex"
  }
]
```

| Field           | Description                                      |
|-----------------|--------------------------------------------------|
| `file`          | Relative path to the source pcapng trace file    |
| `packet_number` | Packet index within the trace file               |
| `ciphertext`    | Hex-encoded ciphertext bytes                     |
| `encoding`      | Always `"hex"`                                   |

### `expected_output/audit.json`

Structured description of the encryption protocol. Validated against
`common/audit_schema.json`.

```json
{
  "ciphers": [
    {
      "cipher": "DES",
      "mode": "ECB",
      "padding": "pkcs7"
    }
  ],
  "vulnerable": true,
  "key_exchange": "none",
  "key_hex": "577331566378376e",
  "iv_hex": null
}
```

### `expected_output/encrypt.py`

Executable Python script implementing the cipher. Follows the interface defined
in `common/encrypt_template.py`:

```
python encrypt.py <plaintext_hex> [--key-hex KEY] [--iv-hex IV]
```

Reads plaintext as hex on the command line, prints ciphertext as hex to stdout.
Applies only the cipher layer -- no compression, base64, or transport encoding.

Expects Python >= 3.11. Install from `common/pyproject.toml`:

```sh
cd common && pip install .
```

### `expected_output/plaintexts.json`

Same structure as `ciphertexts.json` with an added `decrypted` field containing
the known plaintext as a hex string:

```json
[
  {
    "file": "input/traces/com.example.app.pcapng",
    "packet_number": 463,
    "ciphertext": "b31e48f9a23dcf1d...",
    "encoding": "hex",
    "decrypted": "7b22617070766572..."
  }
]
```