YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
PoC: pjreddie/darknet β parse_route() Unchecked Layer Index (CWE-129)
Vulnerability
pjreddie/darknet is the original Darknet neural network framework. Its parse_route() function in src/parser.c reads layer indices from .cfg files via atoi() and uses them to index net->layers[index] without checking index >= 0 && index < net->n.
Affected Code
- File:
src/parser.c(lines 615-619) - Function:
parse_route() - Root cause:
index = atoi(l)used asnet->layers[index].outputswith no bounds check
Impact
A crafted .cfg file with layers=999999 in a [route] section causes darknet to read past the allocated layers array when loading the network configuration. This affects any service that parses user-supplied darknet .cfg files.
Reproduction
Build darknet with AddressSanitizer:
git clone https://github.com/pjreddie/darknet.git
cd darknet
sed -i 's/^CFLAGS=/CFLAGS=-fsanitize=address -g /' Makefile
make -j$(nproc)
Then run with the malicious config:
./darknet yolo test poc_malicious.cfg
Expected: ASan SEGV in parse_route (src/parser.c:1087)
Files
poc_malicious.cfgβ crafted darknet config withlayers=999999parser.cβ real source file from pjreddie/darknet showing vulnerable code
Suggested Fix
// parser.c, after line 617:
if (index < 0 || index >= net->n) {
error("Invalid layer index in route layer");
}
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support