btizzy commited on
Commit
4d9fe4e
·
verified ·
1 Parent(s): 0a65555

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +41 -11
README.md CHANGED
@@ -1,26 +1,56 @@
1
- # Darknet Integer Overflow PoC
2
 
3
- ## Vulnerability
4
- Integer overflow in `make_convolutional_layer()` in `src/convolutional_layer.c`.
5
 
6
- The calculation `l.nweights = (c / groups) * n * size * size` uses 32-bit `int` arithmetic with no overflow check. With crafted config values (`channels=65536, filters=65536, size=1`), `nweights` overflows to 0, causing `xcalloc(0, sizeof(float))` to allocate a zero-sized buffer. The forward pass then reads from this undersized buffer heap buffer over-read.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  ## PoC Files
9
- - `poc_overflow.cfg` — Malicious config file that triggers the overflow
 
 
10
 
11
  ## Reproduction
 
12
  ```bash
13
  git clone https://github.com/AlexeyAB/darknet.git
14
  cd darknet
15
- make
 
16
  ./darknet detector test poc_overflow.cfg
17
  # ASan will report: calloc parameters overflow / heap-buffer-overflow
18
  ```
19
 
20
- ## Impact
21
- - Heap buffer over-read during network inference
22
- - Potential information disclosure or code execution depending on memory layout
23
- - CVSS: High
 
 
 
 
 
 
24
 
25
  ## Discovery
26
- Found by Clawd (OWL) for Huntr bug bounty program.
 
 
1
+ # Darknet Integer Overflow in make_convolutional_layer()
2
 
3
+ ## Vulnerability Summary
 
4
 
5
+ Darknet's `make_convolutional_layer()` in `src/convolutional_layer.c` does not validate integer arithmetic when calculating weight counts from config file values. An attacker who provides a malicious `.cfg` file can trigger a signed integer overflow in the `nweights` calculation, leading to a zero-sized or negative-sized heap allocation and subsequent out-of-bounds memory access during network inference.
6
+
7
+ ## Technical Details
8
+
9
+ **Location**: `src/convolutional_layer.c`, function `make_convolutional_layer()`, line ~543
10
+
11
+ ```c
12
+ l.nweights = (c / groups) * n * size * size;
13
+ ```
14
+
15
+ All variables are `int` (32-bit signed). No overflow check is performed.
16
+
17
+ **Trigger**: Config values `channels=46341, filters=46341, size=1, groups=1`
18
+ - `nweights = 46341 * 46341 * 1 * 1 = 2,147,488,281`
19
+ - This exceeds `INT_MAX` (2,147,483,647) and wraps to **-2,147,479,015**
20
+
21
+ **Consequences**:
22
+ 1. `l.weights = xcalloc(-2147479015, sizeof(float))` — undefined behavior, likely fails or allocates wrong size
23
+ 2. `l.binary_weights = xcalloc(-2147479015, sizeof(float))` — same issue
24
+ 3. Forward pass GEMM operations read from undersized buffers → **heap buffer over-read**
25
+ 4. Potential for information disclosure or code execution depending on memory layout
26
 
27
  ## PoC Files
28
+
29
+ - `poc_overflow.cfg` — Malicious config file that triggers the integer overflow
30
+ - `poc_overflow_zero.cfg` — Variant that causes nweights to overflow to exactly 0
31
 
32
  ## Reproduction
33
+
34
  ```bash
35
  git clone https://github.com/AlexeyAB/darknet.git
36
  cd darknet
37
+ # Build with ASan to detect the overflow
38
+ CFLAGS="-fsanitize=address -g -fno-omit-frame-pointer" make
39
  ./darknet detector test poc_overflow.cfg
40
  # ASan will report: calloc parameters overflow / heap-buffer-overflow
41
  ```
42
 
43
+ ## Novelty
44
+
45
+ - No existing CVEs for Darknet on GitHub Security Advisories or NVD
46
+ - No existing Huntr submissions for Darknet
47
+ - No security-related commits on `convolutional_layer.c` since 2021
48
+ - The vulnerability is in the config parser's math, not in model file loading
49
+
50
+ ## Severity
51
+
52
+ **High** — Integer overflow leading to heap buffer over-read. In a server-side deployment where users can upload model configurations, this could lead to information disclosure or potential code execution.
53
 
54
  ## Discovery
55
+
56
+ Found by Clawd (OWL) for Huntr bug bounty program, May 2026.