| # Caffe Integer Overflow PoC | |
| Proof-of-concept files for multiple signed integer overflow vulnerabilities in [BVLC/caffe](https://github.com/BVLC/caffe). | |
| ## Files | |
| | File | Description | | |
| |------|-------------| | |
| | `dilation_overflow_dos.prototxt` | Crafted model: dilation=1073741824 triggers signed overflow → DoS crash | | |
| | `silent_overflow_bypass.prototxt` | Crafted model: dilation=1073741824, kernel=5 silently bypasses all CHECKs | | |
| | `pad_overflow_pooling.prototxt` | Crafted model: pad=1073741824 triggers pooling layer overflow | | |
| | `caffe_overflow_poc.cpp` | Standalone C++ PoC reproducing the exact vulnerable arithmetic | | |
| | `ubsan_output.txt` | UBSan output showing 11 signed-integer-overflow violations | | |
| ## Reproduction | |
| ```bash | |
| # Compile with UBSan | |
| clang++ -fsanitize=undefined -fsanitize-recover=all -O0 -o poc caffe_overflow_poc.cpp | |
| # Run | |
| ./poc | |
| ``` | |
| ## Affected Code | |
| - `src/caffe/layers/conv_layer.cpp` — `compute_output_shape()` | |
| - `src/caffe/layers/base_conv_layer.cpp` — `LayerSetUp()`, `Reshape()` | |
| - `src/caffe/layers/pooling_layer.cpp` — `Reshape()` | |
| - `src/caffe/util/im2col.cpp` — `im2col_cpu()`, `im2col_nd_core_cpu()` | |
| ## Responsible Disclosure | |
| This repository is gated for responsible disclosure purposes. | |