From 838f5f4ee033d84b3b5f8c8c2da75446f73ada20 Mon Sep 17 00:00:00 2001 From: Christoph Petrausch <christoph.petrausch@inovex.de> Date: Wed, 13 Jun 2018 11:32:07 +0200 Subject: [PATCH] first attempt for fuzzing --- fuzzing/packet/.gitignore | 1 + fuzzing/packet/Makefile | 16 +++ fuzzing/packet/README.md | 8 ++ fuzzing/packet/corpus/0.bytes | Bin 0 -> 19 bytes ...060a1ddeabb5354f79c43182a6d0f9252ddb7db8-1 | Bin 0 -> 37 bytes ...0a8e36b04544c744cf7915e2d85bf93c1dae13d0-4 | Bin 0 -> 157 bytes ...0ace70936b8b67cfeeed133ff8f281b00d502e1b-1 | Bin 0 -> 28 bytes ...0ba3ebb1b2a1029e09c1cb83bc1b09762f231cd8-1 | Bin 0 -> 51 bytes ...0df74acbb6cdec38f5849c0e49f4cacdf1dac629-5 | Bin 0 -> 29 bytes fuzzing/packet/corpus/1.bytes | Bin 0 -> 19 bytes ...17e6634985d31dbeaf2043b77a1e69ba45a02fa3-9 | Bin 0 -> 45 bytes fuzzing/packet/corpus/2.bytes | Bin 0 -> 21 bytes ...246d9b10f27ea92b3318a513ea1223c1dff40be3-7 | Bin 0 -> 39 bytes ...57d2fe4f97aa4541ded8b1a41d6a65ef53d06f1-11 | Bin 0 -> 51 bytes ...25e08ee00ac1320e41d90fa58d3149b3733448a6-8 | Bin 0 -> 48 bytes fuzzing/packet/corpus/3.bytes | Bin 0 -> 29 bytes ...3a199e742da9c4c4898f7a80306b1f68f7ab66c6-3 | Bin 0 -> 32 bytes ...3b1d7d76919291b6744b54fd2158f5df5c61ed2d-1 | Bin 0 -> 17 bytes ...3e079343af2c1e793bbd2c8fcd672ec56dc6c25c-4 | Bin 0 -> 105 bytes fuzzing/packet/corpus/4.bytes | Bin 0 -> 28 bytes ...4466603d1b8c2cbd09564a017acf94ab067a978a-5 | Bin 0 -> 37 bytes ...48befb084cbe2e3036885a4e93fa62530717e2c4-2 | Bin 0 -> 69 bytes fuzzing/packet/corpus/5.bytes | Bin 0 -> 28 bytes ...58417300797958a8d956a72f0d461c46bebf266e-3 | Bin 0 -> 86 bytes ...5fd3ce661a420848e4aaedfd43ace8bd2898ff24-7 | Bin 0 -> 40 bytes fuzzing/packet/corpus/6.bytes | Bin 0 -> 28 bytes ...62371dc5941146bd5d11d3a664a6242e36bcc01f-1 | 1 + ...3e58e734f4d8ab5d25f4fb42a0a97fbb981e49a-10 | Bin 0 -> 49 bytes ...6698ba73735503c91bd06725a28dd97520492943-6 | Bin 0 -> 27 bytes ...6d51a3c633b809e379ccf02b1d89e651ed886248-2 | Bin 0 -> 38 bytes ...6f9ac81c48e9f8adb7162137978afe333b73d5be-3 | Bin 0 -> 37 bytes ...83e5382679a52a38b6ee66e19234850c6445276b-9 | Bin 0 -> 43 bytes ...85e53271e14006f0265921d02d4d736cdc580b0b-1 | 1 + ...a1a7f1b3b949cdd10400b4f6a06287b263a36477-4 | Bin 0 -> 34 bytes ...a3d0c7741496b9936f0f467f7651f03578fb761e-6 | Bin 0 -> 40 bytes ...a8e7928916f90886b3d773931170eb8f562d72fe-5 | Bin 0 -> 105 bytes ...ad17b9fa9045080d6e1aa6c5c7580a10eed4ecb8-3 | Bin 0 -> 54 bytes .../afa974e4717ef61591231fb3cac26787aa908258 | 1 + ...b334ba4f2e51dd6bfdf68994e9e572ef59fb31d4-2 | Bin 0 -> 97 bytes ...b6dc94ef39eb455c359b60e2813ae55665c6c085-1 | Bin 0 -> 28 bytes ...7bdc0d8438edee7257cbdf70c36cb7d1f7035fa-10 | Bin 0 -> 83 bytes ...b851290ca41de3bd9cacf5dd88650582409f9527-2 | Bin 0 -> 43 bytes ...b9266e7167c429092cb26b3dff879f40891c3b7d-2 | Bin 0 -> 32 bytes ...bc6400ae15329575a729943ccc9d0087c5ddfa75-1 | Bin 0 -> 29 bytes ...be687b1f2a8136b143e55a736b9b78cc3ea7c3ba-4 | Bin 0 -> 90 bytes ...c18bebbf42f8553ed0ba3a214155e9b8e7f88e10-1 | Bin 0 -> 32 bytes ...caf0fa4d68cf307435b48a4b673807f7e5eab117-1 | Bin 0 -> 21 bytes .../ce6cfb94676fdceb717db4b1513bdaf00e8b5b95 | Bin 0 -> 19 bytes ...ce8172f26f9352332a6dd74d2bbf557182fbb77c-1 | Bin 0 -> 30 bytes ...cf35187f48183cd066ab36204b2bed41a1636e8f-8 | Bin 0 -> 54 bytes ...d25c953c2dfc83461f6308c7b153dfc582ad65f8-3 | Bin 0 -> 109 bytes ...d834b8ed259157d28b3d8340b1000fc5332165cd-2 | Bin 0 -> 41 bytes ...d947e66423d44f11981817d9a4ed5f36edc1d73b-1 | Bin 0 -> 16 bytes ...dc619c747104de130ec7e3424f9834e77e804c45-7 | Bin 0 -> 49 bytes ...6126c61f9505667f0a7cb2b90fb60c31dfded40-12 | Bin 0 -> 74 bytes ...e70ffd323bf2dde3ff5ca80b4e6395724467b98d-4 | Bin 0 -> 37 bytes ...e7952b4c14d15d88eaf665083a22778642302998-3 | Bin 0 -> 31 bytes ...fa4f6be24ac4351604432e26ce02b1c38b213abb-6 | Bin 0 -> 37 bytes ...fd371aa158566c6ff56ed1ad10898d075ea37216-4 | Bin 0 -> 36 bytes fuzzing/packet/gen_initial_corpus.go | 107 ++++++++++++++++++ protocols/bgp/packet/fuzzing.go | 25 ++++ 61 files changed, 160 insertions(+) create mode 100644 fuzzing/packet/.gitignore create mode 100644 fuzzing/packet/Makefile create mode 100644 fuzzing/packet/README.md create mode 100644 fuzzing/packet/corpus/0.bytes create mode 100644 fuzzing/packet/corpus/060a1ddeabb5354f79c43182a6d0f9252ddb7db8-1 create mode 100644 fuzzing/packet/corpus/0a8e36b04544c744cf7915e2d85bf93c1dae13d0-4 create mode 100644 fuzzing/packet/corpus/0ace70936b8b67cfeeed133ff8f281b00d502e1b-1 create mode 100644 fuzzing/packet/corpus/0ba3ebb1b2a1029e09c1cb83bc1b09762f231cd8-1 create mode 100644 fuzzing/packet/corpus/0df74acbb6cdec38f5849c0e49f4cacdf1dac629-5 create mode 100644 fuzzing/packet/corpus/1.bytes create mode 100644 fuzzing/packet/corpus/17e6634985d31dbeaf2043b77a1e69ba45a02fa3-9 create mode 100644 fuzzing/packet/corpus/2.bytes create mode 100644 fuzzing/packet/corpus/246d9b10f27ea92b3318a513ea1223c1dff40be3-7 create mode 100644 fuzzing/packet/corpus/257d2fe4f97aa4541ded8b1a41d6a65ef53d06f1-11 create mode 100644 fuzzing/packet/corpus/25e08ee00ac1320e41d90fa58d3149b3733448a6-8 create mode 100644 fuzzing/packet/corpus/3.bytes create mode 100644 fuzzing/packet/corpus/3a199e742da9c4c4898f7a80306b1f68f7ab66c6-3 create mode 100644 fuzzing/packet/corpus/3b1d7d76919291b6744b54fd2158f5df5c61ed2d-1 create mode 100644 fuzzing/packet/corpus/3e079343af2c1e793bbd2c8fcd672ec56dc6c25c-4 create mode 100644 fuzzing/packet/corpus/4.bytes create mode 100644 fuzzing/packet/corpus/4466603d1b8c2cbd09564a017acf94ab067a978a-5 create mode 100644 fuzzing/packet/corpus/48befb084cbe2e3036885a4e93fa62530717e2c4-2 create mode 100644 fuzzing/packet/corpus/5.bytes create mode 100644 fuzzing/packet/corpus/58417300797958a8d956a72f0d461c46bebf266e-3 create mode 100644 fuzzing/packet/corpus/5fd3ce661a420848e4aaedfd43ace8bd2898ff24-7 create mode 100644 fuzzing/packet/corpus/6.bytes create mode 100644 fuzzing/packet/corpus/62371dc5941146bd5d11d3a664a6242e36bcc01f-1 create mode 100644 fuzzing/packet/corpus/63e58e734f4d8ab5d25f4fb42a0a97fbb981e49a-10 create mode 100644 fuzzing/packet/corpus/6698ba73735503c91bd06725a28dd97520492943-6 create mode 100644 fuzzing/packet/corpus/6d51a3c633b809e379ccf02b1d89e651ed886248-2 create mode 100644 fuzzing/packet/corpus/6f9ac81c48e9f8adb7162137978afe333b73d5be-3 create mode 100644 fuzzing/packet/corpus/83e5382679a52a38b6ee66e19234850c6445276b-9 create mode 100644 fuzzing/packet/corpus/85e53271e14006f0265921d02d4d736cdc580b0b-1 create mode 100644 fuzzing/packet/corpus/a1a7f1b3b949cdd10400b4f6a06287b263a36477-4 create mode 100644 fuzzing/packet/corpus/a3d0c7741496b9936f0f467f7651f03578fb761e-6 create mode 100644 fuzzing/packet/corpus/a8e7928916f90886b3d773931170eb8f562d72fe-5 create mode 100644 fuzzing/packet/corpus/ad17b9fa9045080d6e1aa6c5c7580a10eed4ecb8-3 create mode 100644 fuzzing/packet/corpus/afa974e4717ef61591231fb3cac26787aa908258 create mode 100644 fuzzing/packet/corpus/b334ba4f2e51dd6bfdf68994e9e572ef59fb31d4-2 create mode 100644 fuzzing/packet/corpus/b6dc94ef39eb455c359b60e2813ae55665c6c085-1 create mode 100644 fuzzing/packet/corpus/b7bdc0d8438edee7257cbdf70c36cb7d1f7035fa-10 create mode 100644 fuzzing/packet/corpus/b851290ca41de3bd9cacf5dd88650582409f9527-2 create mode 100644 fuzzing/packet/corpus/b9266e7167c429092cb26b3dff879f40891c3b7d-2 create mode 100644 fuzzing/packet/corpus/bc6400ae15329575a729943ccc9d0087c5ddfa75-1 create mode 100644 fuzzing/packet/corpus/be687b1f2a8136b143e55a736b9b78cc3ea7c3ba-4 create mode 100644 fuzzing/packet/corpus/c18bebbf42f8553ed0ba3a214155e9b8e7f88e10-1 create mode 100644 fuzzing/packet/corpus/caf0fa4d68cf307435b48a4b673807f7e5eab117-1 create mode 100644 fuzzing/packet/corpus/ce6cfb94676fdceb717db4b1513bdaf00e8b5b95 create mode 100644 fuzzing/packet/corpus/ce8172f26f9352332a6dd74d2bbf557182fbb77c-1 create mode 100644 fuzzing/packet/corpus/cf35187f48183cd066ab36204b2bed41a1636e8f-8 create mode 100644 fuzzing/packet/corpus/d25c953c2dfc83461f6308c7b153dfc582ad65f8-3 create mode 100644 fuzzing/packet/corpus/d834b8ed259157d28b3d8340b1000fc5332165cd-2 create mode 100644 fuzzing/packet/corpus/d947e66423d44f11981817d9a4ed5f36edc1d73b-1 create mode 100644 fuzzing/packet/corpus/dc619c747104de130ec7e3424f9834e77e804c45-7 create mode 100644 fuzzing/packet/corpus/e6126c61f9505667f0a7cb2b90fb60c31dfded40-12 create mode 100644 fuzzing/packet/corpus/e70ffd323bf2dde3ff5ca80b4e6395724467b98d-4 create mode 100644 fuzzing/packet/corpus/e7952b4c14d15d88eaf665083a22778642302998-3 create mode 100644 fuzzing/packet/corpus/fa4f6be24ac4351604432e26ce02b1c38b213abb-6 create mode 100644 fuzzing/packet/corpus/fd371aa158566c6ff56ed1ad10898d075ea37216-4 create mode 100644 fuzzing/packet/gen_initial_corpus.go create mode 100644 protocols/bgp/packet/fuzzing.go diff --git a/fuzzing/packet/.gitignore b/fuzzing/packet/.gitignore new file mode 100644 index 00000000..818d7868 --- /dev/null +++ b/fuzzing/packet/.gitignore @@ -0,0 +1 @@ +packet-fuzz.zip diff --git a/fuzzing/packet/Makefile b/fuzzing/packet/Makefile new file mode 100644 index 00000000..c4b419ae --- /dev/null +++ b/fuzzing/packet/Makefile @@ -0,0 +1,16 @@ + +$(GOPATH)/bin/go-fuzz-build: + go get -u github.com/dvyukov/go-fuzz/... + +$(GOPATH)/bin/go-fuzz: + go get -u github.com/dvyukov/go-fuzz/... + +packet-fuzz.zip: $(GOPATH)/bin/go-fuzz-build + $(GOPATH)/bin/go-fuzz-build github.com/bio-routing/bio-rd/protocols/bgp/packet + +corpus: + mkdir -p corpus + go run gen_initial_corpus.go + +fuzz: packet-fuzz.zip corpus $(GOPATH)/bin/go-fuzz + $(GOPATH)/bin/go-fuzz -bin=./packet-fuzz.zip -workdir=. diff --git a/fuzzing/packet/README.md b/fuzzing/packet/README.md new file mode 100644 index 00000000..b7f396f1 --- /dev/null +++ b/fuzzing/packet/README.md @@ -0,0 +1,8 @@ +# Fuzzing + +To start a new fuzzing run, execute: +```bash +make fuzz +``` +This will create an initial corpus if there is no corpus, download the fuzzing tool and build all required +assets. \ No newline at end of file diff --git a/fuzzing/packet/corpus/0.bytes b/fuzzing/packet/corpus/0.bytes new file mode 100644 index 0000000000000000000000000000000000000000..78ebde2e66d5283d5601ba30a9cd3ebb3f054081 GIT binary patch literal 19 Mcmey51{j1{0Jnt@2mk;8 literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/060a1ddeabb5354f79c43182a6d0f9252ddb7db8-1 b/fuzzing/packet/corpus/060a1ddeabb5354f79c43182a6d0f9252ddb7db8-1 new file mode 100644 index 0000000000000000000000000000000000000000..08dc6dddb954f97714f7dc009aed3130e5efd9c7 GIT binary patch literal 37 ccmey51{h=+Sr|?*fJ7N&m{Rz;MC3FW034<j%m4rY literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/0a8e36b04544c744cf7915e2d85bf93c1dae13d0-4 b/fuzzing/packet/corpus/0a8e36b04544c744cf7915e2d85bf93c1dae13d0-4 new file mode 100644 index 0000000000000000000000000000000000000000..9694ef60b9f7abbade8a07127e047742cfcb7364 GIT binary patch literal 157 zcmey51{h?R7#Q9&$S`p*Fm5w7H8eCdH!w0Zv@kR^G%_|cGBvj_f(cj{n;4jwniv`w znwlAzGBlW&SXvrc8kiaznwc4x8(5giFma%1Il;idAOhFIt>-!+8Db%`IyZw1N5Ow5 R(d=M`@?Q)LvWzSO2LQa$EI9xG literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/0ace70936b8b67cfeeed133ff8f281b00d502e1b-1 b/fuzzing/packet/corpus/0ace70936b8b67cfeeed133ff8f281b00d502e1b-1 new file mode 100644 index 0000000000000000000000000000000000000000..fca5e54c0c0b31138223cac205cc5d2eec19dab6 GIT binary patch literal 28 Wcmey51{h?RQW!WG7#ROEFaQ8f=n;DW literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/0ba3ebb1b2a1029e09c1cb83bc1b09762f231cd8-1 b/fuzzing/packet/corpus/0ba3ebb1b2a1029e09c1cb83bc1b09762f231cd8-1 new file mode 100644 index 0000000000000000000000000000000000000000..4ebdac5e15dc9c6190df6e8730e626b6d389fecf GIT binary patch literal 51 tcmey51{h?R7#Q9&$S`p*Fmmg;PDtiB`JaJ7mXU?wgf$13z=0JE+5jb17eD|2 literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/0df74acbb6cdec38f5849c0e49f4cacdf1dac629-5 b/fuzzing/packet/corpus/0df74acbb6cdec38f5849c0e49f4cacdf1dac629-5 new file mode 100644 index 0000000000000000000000000000000000000000..1e1eda6a2120468d20537d993740fb29b567237e GIT binary patch literal 29 Xcmey51{h?R7#LC*7#J8B|1$spU0V@z literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/1.bytes b/fuzzing/packet/corpus/1.bytes new file mode 100644 index 0000000000000000000000000000000000000000..04273bea1f62cdd2a9296e73e70d9b6623b5172c GIT binary patch literal 19 NcmZQX1xyUWEC2xc04V?f literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/17e6634985d31dbeaf2043b77a1e69ba45a02fa3-9 b/fuzzing/packet/corpus/17e6634985d31dbeaf2043b77a1e69ba45a02fa3-9 new file mode 100644 index 0000000000000000000000000000000000000000..2a5dacba3c5838bc8c24e218a6ba509a546dc580 GIT binary patch literal 45 lcmey51{h?R7#QCFPpJ`R;9y`B>+$%X0%GX=XJBMt006$37JC2y literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/2.bytes b/fuzzing/packet/corpus/2.bytes new file mode 100644 index 0000000000000000000000000000000000000000..1e1a88bf442e0b13f058e7acf0460c1b703b9073 GIT binary patch literal 21 Ocmey51{g${85sfBoe&EE literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/246d9b10f27ea92b3318a513ea1223c1dff40be3-7 b/fuzzing/packet/corpus/246d9b10f27ea92b3318a513ea1223c1dff40be3-7 new file mode 100644 index 0000000000000000000000000000000000000000..3fdac995b8aad35e3e2d027813fbadec3ee9c6f7 GIT binary patch literal 39 dcmey51{h?R7#QAjGsrM7{%2rdU|<B(?*SbI6cqpf literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/257d2fe4f97aa4541ded8b1a41d6a65ef53d06f1-11 b/fuzzing/packet/corpus/257d2fe4f97aa4541ded8b1a41d6a65ef53d06f1-11 new file mode 100644 index 0000000000000000000000000000000000000000..f678e21962289f0b8d8f786baeb1d647472f92c1 GIT binary patch literal 51 jcmey51{h?R7#RLDa4;}3Fr+YWFo1y0e-Mum!~|gg@~#rF literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/25e08ee00ac1320e41d90fa58d3149b3733448a6-8 b/fuzzing/packet/corpus/25e08ee00ac1320e41d90fa58d3149b3733448a6-8 new file mode 100644 index 0000000000000000000000000000000000000000..fa25df350a0a887488fcabd5fa90a5109e03e16a GIT binary patch literal 48 kcmey51{h?R7#QCFPhsF-;9y`B>+t|H8Fl_MFfxDu0QGGZ^Z)<= literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/3.bytes b/fuzzing/packet/corpus/3.bytes new file mode 100644 index 0000000000000000000000000000000000000000..0bb83b59d69896621882b77884c4ab519e407ee5 GIT binary patch literal 29 Xcmey51{h=+Sr|?*@N<dCX)pi)U?~w! literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/3a199e742da9c4c4898f7a80306b1f68f7ab66c6-3 b/fuzzing/packet/corpus/3a199e742da9c4c4898f7a80306b1f68f7ab66c6-3 new file mode 100644 index 0000000000000000000000000000000000000000..bdeac6422ad6918320549b196d904d3e524557e0 GIT binary patch literal 32 acmey51{h?R7#NvS7&sUh82>Xcyaxc0p%QHX literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/3b1d7d76919291b6744b54fd2158f5df5c61ed2d-1 b/fuzzing/packet/corpus/3b1d7d76919291b6744b54fd2158f5df5c61ed2d-1 new file mode 100644 index 0000000000000000000000000000000000000000..886f01d35d0c580a4e4ed0bdc5ed8dabedb2811c GIT binary patch literal 17 Kcmey51{eUBc@Oab literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/3e079343af2c1e793bbd2c8fcd672ec56dc6c25c-4 b/fuzzing/packet/corpus/3e079343af2c1e793bbd2c8fcd672ec56dc6c25c-4 new file mode 100644 index 0000000000000000000000000000000000000000..346bb1b3db8c5d09d21891a2d0e38d1af60cabc2 GIT binary patch literal 105 wcmey51{h?RQVibj-}`<)iUdM<Z)yNodaphM2Ll7+e+Gv4|NsAo2;q|h0OjIF`~Uy| literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/4.bytes b/fuzzing/packet/corpus/4.bytes new file mode 100644 index 0000000000000000000000000000000000000000..10fc460ddcfa541f70d4d1ea6bbdf76369b98205 GIT binary patch literal 28 Wcmey51{h=*Sr|?*@G~$lqyPX;Y!OWW literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/4466603d1b8c2cbd09564a017acf94ab067a978a-5 b/fuzzing/packet/corpus/4466603d1b8c2cbd09564a017acf94ab067a978a-5 new file mode 100644 index 0000000000000000000000000000000000000000..32b10d9c709e0bebc9d8f782e58e84d16212a1bb GIT binary patch literal 37 ccmey51{h?R7#QCFPhsF-VEoU(@E*(r02J^RvH$=8 literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/48befb084cbe2e3036885a4e93fa62530717e2c4-2 b/fuzzing/packet/corpus/48befb084cbe2e3036885a4e93fa62530717e2c4-2 new file mode 100644 index 0000000000000000000000000000000000000000..4302f83d6d18a86ddd8abb6fa301f48731c60ffb GIT binary patch literal 69 zcmey51{h=+Sr|?*fJ7N&n7E8hO^wVAjm^w0EDQ`x4Gb)eER9V~&5R6<jm<4A4a|&8 IMdUOX08YjnN&o-= literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/5.bytes b/fuzzing/packet/corpus/5.bytes new file mode 100644 index 0000000000000000000000000000000000000000..2c7f282c3e1ff5041b60af15b15876e339cb6d2f GIT binary patch literal 28 Wcmey51{h?R7+5*D1P-iVU;qG44-uXK literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/58417300797958a8d956a72f0d461c46bebf266e-3 b/fuzzing/packet/corpus/58417300797958a8d956a72f0d461c46bebf266e-3 new file mode 100644 index 0000000000000000000000000000000000000000..d14799d5d94c1f78b1a38e7a0fb4ff0fa10e2937 GIT binary patch literal 86 zcmey51{h?R7#KJh7)?!04Gj%V4ULQqjZDogjLZ#;3=J&|O)ZQ~3`|T-3=IrT&5TUB Z^;{<;gSEV8kl{G_pMgP^k%i%eH2{2P9Yz2E literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/5fd3ce661a420848e4aaedfd43ace8bd2898ff24-7 b/fuzzing/packet/corpus/5fd3ce661a420848e4aaedfd43ace8bd2898ff24-7 new file mode 100644 index 0000000000000000000000000000000000000000..e2a95b9ba53a202301da06c811046ed46fbe1dfd GIT binary patch literal 40 dcmey51{h?R7#ROEFuebt!oa}*V(Nf+?*UMG7jggq literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/6.bytes b/fuzzing/packet/corpus/6.bytes new file mode 100644 index 0000000000000000000000000000000000000000..47a09db59b6e2e494c99f0aee1d98566507bde2d GIT binary patch literal 28 Wcmey51{h>m8CW^E1P-iVU;qG4EfJvr literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/62371dc5941146bd5d11d3a664a6242e36bcc01f-1 b/fuzzing/packet/corpus/62371dc5941146bd5d11d3a664a6242e36bcc01f-1 new file mode 100644 index 00000000..1edd95f2 --- /dev/null +++ b/fuzzing/packet/corpus/62371dc5941146bd5d11d3a664a6242e36bcc01f-1 @@ -0,0 +1 @@ +���������������� \ No newline at end of file diff --git a/fuzzing/packet/corpus/63e58e734f4d8ab5d25f4fb42a0a97fbb981e49a-10 b/fuzzing/packet/corpus/63e58e734f4d8ab5d25f4fb42a0a97fbb981e49a-10 new file mode 100644 index 0000000000000000000000000000000000000000..823a32b86a4c7f33f16fed2a30f9055933cbe552 GIT binary patch literal 49 icmey51{h?R7#QCFPhsHb@c@wwj5_}r7#To_0So{dFBR4R literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/6698ba73735503c91bd06725a28dd97520492943-6 b/fuzzing/packet/corpus/6698ba73735503c91bd06725a28dd97520492943-6 new file mode 100644 index 0000000000000000000000000000000000000000..9c8f6e57161994df837b8bbcd98113dbcfdd531f GIT binary patch literal 27 Vcmey51{h?R7#LC*7?@u$0suTt5nliR literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/6d51a3c633b809e379ccf02b1d89e651ed886248-2 b/fuzzing/packet/corpus/6d51a3c633b809e379ccf02b1d89e651ed886248-2 new file mode 100644 index 0000000000000000000000000000000000000000..9330e79e146399577b359e7132ecc2449948e42e GIT binary patch literal 38 hcmey51{h?RQW!WG7#ROEFuec&|Nr~_d*AQh3ji=w8a)62 literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/6f9ac81c48e9f8adb7162137978afe333b73d5be-3 b/fuzzing/packet/corpus/6f9ac81c48e9f8adb7162137978afe333b73d5be-3 new file mode 100644 index 0000000000000000000000000000000000000000..6fdb34b7aa71ec77f33ba2691a575b81964c3ff5 GIT binary patch literal 37 acmey51{h?R7#ROEFuebt!oa}*WdZ;VOBPoE literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/83e5382679a52a38b6ee66e19234850c6445276b-9 b/fuzzing/packet/corpus/83e5382679a52a38b6ee66e19234850c6445276b-9 new file mode 100644 index 0000000000000000000000000000000000000000..d0e0d2fc3c388b86b978dee344b41b24e071d569 GIT binary patch literal 43 gcmey51{h?R7#QCFPhsHb@c@wwj5_}r7#TnS0GAmR)c^nh literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/85e53271e14006f0265921d02d4d736cdc580b0b-1 b/fuzzing/packet/corpus/85e53271e14006f0265921d02d4d736cdc580b0b-1 new file mode 100644 index 00000000..ce542efa --- /dev/null +++ b/fuzzing/packet/corpus/85e53271e14006f0265921d02d4d736cdc580b0b-1 @@ -0,0 +1 @@ +� \ No newline at end of file diff --git a/fuzzing/packet/corpus/a1a7f1b3b949cdd10400b4f6a06287b263a36477-4 b/fuzzing/packet/corpus/a1a7f1b3b949cdd10400b4f6a06287b263a36477-4 new file mode 100644 index 0000000000000000000000000000000000000000..c63b223b6abc0b81cf213f7f28516e84de3b7209 GIT binary patch literal 34 acmey51{h?R7#QCFPhsF-U|{?YVgdlo4i#4b literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/a3d0c7741496b9936f0f467f7651f03578fb761e-6 b/fuzzing/packet/corpus/a3d0c7741496b9936f0f467f7651f03578fb761e-6 new file mode 100644 index 0000000000000000000000000000000000000000..3c3ea8f7921fda46cc2120fd5e43a86421da6fdb GIT binary patch literal 40 icmey51{h?R7#QCFPhsF-U=-`|2yAH9`Om=c{yhLt+!wI` literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/a8e7928916f90886b3d773931170eb8f562d72fe-5 b/fuzzing/packet/corpus/a8e7928916f90886b3d773931170eb8f562d72fe-5 new file mode 100644 index 0000000000000000000000000000000000000000..f3d634a6e0fcbad8ce496a353e6947f48b67b85f GIT binary patch literal 105 zcmey51{h=+S;S5-fJ7N&nD*~|zdwbaOGJ)AhAGA1J&3zEH2^~EGjK34F#cy?c>n+Z Je~1u1IRIYpJ~03Q literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/ad17b9fa9045080d6e1aa6c5c7580a10eed4ecb8-3 b/fuzzing/packet/corpus/ad17b9fa9045080d6e1aa6c5c7580a10eed4ecb8-3 new file mode 100644 index 0000000000000000000000000000000000000000..f412b003b5743bd2c3d881ba903805c62f93b902 GIT binary patch literal 54 ocmey51{h?RQVibj-}`?5-qZjHt<S*0z`*#Qf#LoC|NkLE099Nh{Qv*} literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/afa974e4717ef61591231fb3cac26787aa908258 b/fuzzing/packet/corpus/afa974e4717ef61591231fb3cac26787aa908258 new file mode 100644 index 00000000..22685bbf --- /dev/null +++ b/fuzzing/packet/corpus/afa974e4717ef61591231fb3cac26787aa908258 @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/fuzzing/packet/corpus/b334ba4f2e51dd6bfdf68994e9e572ef59fb31d4-2 b/fuzzing/packet/corpus/b334ba4f2e51dd6bfdf68994e9e572ef59fb31d4-2 new file mode 100644 index 0000000000000000000000000000000000000000..53bb04d5f81ec9b64e56928692c9e913ee61febf GIT binary patch literal 97 zcmey51{h?R7#Q9&$S`p*Fq)d08X6j!8X6fJ8kw3~7?~Rw85&v`npzl}7?_xv7#bLw hni-jL>$y%yhH2wC`JaJ7mXU?wgf$13z=0JE+5q1nAP4{e literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/b6dc94ef39eb455c359b60e2813ae55665c6c085-1 b/fuzzing/packet/corpus/b6dc94ef39eb455c359b60e2813ae55665c6c085-1 new file mode 100644 index 0000000000000000000000000000000000000000..1f3855616eb73206f1461e5b155add4be7320f93 GIT binary patch literal 28 Wcmey51{h?R7+5*D1P-iVPyhf<FA=@~ literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/b7bdc0d8438edee7257cbdf70c36cb7d1f7035fa-10 b/fuzzing/packet/corpus/b7bdc0d8438edee7257cbdf70c36cb7d1f7035fa-10 new file mode 100644 index 0000000000000000000000000000000000000000..5f0af85d8332a28978c53ef26ceb11dcfdaf6556 GIT binary patch literal 83 zcmey51{h?R7#ME<PpJ`R;9y`B>+$%X0%GXorIzPp=A|lR<|(A*7v(0FD5T`47AxfC Xmnh^WmLz8=Wabr=mi%X6WMBXQNGT+; literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/b851290ca41de3bd9cacf5dd88650582409f9527-2 b/fuzzing/packet/corpus/b851290ca41de3bd9cacf5dd88650582409f9527-2 new file mode 100644 index 0000000000000000000000000000000000000000..b22466e4b93c989e41cb4e2cccf9dc38cd43c641 GIT binary patch literal 43 jcmey51{h=+Sr|?*fJ7N&m{Rz;MD$~`WumhV%4q-qt6CUk literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/b9266e7167c429092cb26b3dff879f40891c3b7d-2 b/fuzzing/packet/corpus/b9266e7167c429092cb26b3dff879f40891c3b7d-2 new file mode 100644 index 0000000000000000000000000000000000000000..391ca0052bf8c728fb4b8c336f4a5da65426223c GIT binary patch literal 32 acmey51{h?RQW!WG7#ROEFudQtml*(@N)zb- literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/bc6400ae15329575a729943ccc9d0087c5ddfa75-1 b/fuzzing/packet/corpus/bc6400ae15329575a729943ccc9d0087c5ddfa75-1 new file mode 100644 index 0000000000000000000000000000000000000000..22b00376b7bce3e66d18782ab69121547269d01c GIT binary patch literal 29 Xcmey51{h=+Sr|?*@N<dCF|q&vU*8cc literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/be687b1f2a8136b143e55a736b9b78cc3ea7c3ba-4 b/fuzzing/packet/corpus/be687b1f2a8136b143e55a736b9b78cc3ea7c3ba-4 new file mode 100644 index 0000000000000000000000000000000000000000..4aee6a1587c2b976c703a0971134f5035724ff0c GIT binary patch literal 90 zcmey51{h?R7#KJh7)?!+6LWG*4ULQqjZDogjLZ#;3=J&|O)ZQ~3{1>T3=IrT&5TUB Z^;{<;Gcd?9vM_)(zGsl(IQbtU000lk9XkL3 literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/c18bebbf42f8553ed0ba3a214155e9b8e7f88e10-1 b/fuzzing/packet/corpus/c18bebbf42f8553ed0ba3a214155e9b8e7f88e10-1 new file mode 100644 index 0000000000000000000000000000000000000000..2877cb62182ad6ce38e8b5b849c7b2341440915c GIT binary patch literal 32 acmey51{h?R7+5*D1P-it5?b|&fdK%ZE)+We literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/caf0fa4d68cf307435b48a4b673807f7e5eab117-1 b/fuzzing/packet/corpus/caf0fa4d68cf307435b48a4b673807f7e5eab117-1 new file mode 100644 index 0000000000000000000000000000000000000000..d4c0159f724d0c2ea9725f50aafc15734665f517 GIT binary patch literal 21 Ocmey51{g${8I=LozYr|| literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/ce6cfb94676fdceb717db4b1513bdaf00e8b5b95 b/fuzzing/packet/corpus/ce6cfb94676fdceb717db4b1513bdaf00e8b5b95 new file mode 100644 index 0000000000000000000000000000000000000000..452f3353cce296d859cb4a771c63f964d10e451d GIT binary patch literal 19 Mcmey51{h>m0k@bC5&!@I literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/ce8172f26f9352332a6dd74d2bbf557182fbb77c-1 b/fuzzing/packet/corpus/ce8172f26f9352332a6dd74d2bbf557182fbb77c-1 new file mode 100644 index 0000000000000000000000000000000000000000..198f6a3ac64a668b3803faaa92f1a387b7393787 GIT binary patch literal 30 Ycmey51{h?R7+5*D1P-iV`2YVu0Cz<cn*aa+ literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/cf35187f48183cd066ab36204b2bed41a1636e8f-8 b/fuzzing/packet/corpus/cf35187f48183cd066ab36204b2bed41a1636e8f-8 new file mode 100644 index 0000000000000000000000000000000000000000..0f9f67d9e93dad4486354c0d8bfdadf76e33925b GIT binary patch literal 54 qcmey51{h?R7#QCFPhsF-;9y`B>v{j5L57JD%xBd3&+wlCtR4WTtsSxe literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/d25c953c2dfc83461f6308c7b153dfc582ad65f8-3 b/fuzzing/packet/corpus/d25c953c2dfc83461f6308c7b153dfc582ad65f8-3 new file mode 100644 index 0000000000000000000000000000000000000000..7e9df35c1cd8ff889a34b9ba5be3a13f79d22f31 GIT binary patch literal 109 zcmey51{h?R7#Q9&Ff^E$SXvrc8kiaznwc4x8(5giFmV_g8kw3~7?~Rw85&v`npzl} u7?_xv7#bLwni-jL>$y%yhH97LIQid6G&}f2`7Z_rSw<Fy6V@DD0tW!Q-6XaE literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/d834b8ed259157d28b3d8340b1000fc5332165cd-2 b/fuzzing/packet/corpus/d834b8ed259157d28b3d8340b1000fc5332165cd-2 new file mode 100644 index 0000000000000000000000000000000000000000..2b38f32e0c77532d08cee62fcd0e5f7fb16620c2 GIT binary patch literal 41 hcmey51{h=+S;S5-fJ7N&nD*~|zdwbaOGHkC0RWIb84Lgb literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/d947e66423d44f11981817d9a4ed5f36edc1d73b-1 b/fuzzing/packet/corpus/d947e66423d44f11981817d9a4ed5f36edc1d73b-1 new file mode 100644 index 0000000000000000000000000000000000000000..dc069282d48156996b283a49aea3be81ebb2ef87 GIT binary patch literal 16 Kcmey53K#%}i4O7r literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/dc619c747104de130ec7e3424f9834e77e804c45-7 b/fuzzing/packet/corpus/dc619c747104de130ec7e3424f9834e77e804c45-7 new file mode 100644 index 0000000000000000000000000000000000000000..e6492c7022a473f45bb0a9830f4651e1f4a5b5f8 GIT binary patch literal 49 kcmey51{h?R7#QCFPhsF-;9y`B>+t|H8Fl_MFhEoS03cKw?EnA( literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/e6126c61f9505667f0a7cb2b90fb60c31dfded40-12 b/fuzzing/packet/corpus/e6126c61f9505667f0a7cb2b90fb60c31dfded40-12 new file mode 100644 index 0000000000000000000000000000000000000000..6b7b4d0daa83d60d257c357e510229a6a905dc89 GIT binary patch literal 74 pcmey51{h?R7#RLDa4;}1q<~2V2A%&5j0_;ezyKD(CeFaX006xk6i@&F literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/e70ffd323bf2dde3ff5ca80b4e6395724467b98d-4 b/fuzzing/packet/corpus/e70ffd323bf2dde3ff5ca80b4e6395724467b98d-4 new file mode 100644 index 0000000000000000000000000000000000000000..b7f8489eca2e83a61625423e289e9de86979bea5 GIT binary patch literal 37 acmey51{h?R7#Ja93`{8u91IMM{}})-<QI4V literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/e7952b4c14d15d88eaf665083a22778642302998-3 b/fuzzing/packet/corpus/e7952b4c14d15d88eaf665083a22778642302998-3 new file mode 100644 index 0000000000000000000000000000000000000000..5292b1fd24d40ebc5f1dff6473d539e47a6cd064 GIT binary patch literal 31 acmey51{h?R7#QFG|NsB}{=M(_?*#y=@)*(p literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/fa4f6be24ac4351604432e26ce02b1c38b213abb-6 b/fuzzing/packet/corpus/fa4f6be24ac4351604432e26ce02b1c38b213abb-6 new file mode 100644 index 0000000000000000000000000000000000000000..cebbd01da53b2bdd3ec5c9f0e265ef83c5771537 GIT binary patch literal 37 fcmey51{h?R7#Q9&$S`p*F#cy?c>n%?3IhiK0x1=3 literal 0 HcmV?d00001 diff --git a/fuzzing/packet/corpus/fd371aa158566c6ff56ed1ad10898d075ea37216-4 b/fuzzing/packet/corpus/fd371aa158566c6ff56ed1ad10898d075ea37216-4 new file mode 100644 index 0000000000000000000000000000000000000000..d0e8c3419a3c7ceb124d1eb064549a6a8324274e GIT binary patch literal 36 ccmey51{h?R7#ROEFuebt!XUuFzyM+b0QVpjUjP6A literal 0 HcmV?d00001 diff --git a/fuzzing/packet/gen_initial_corpus.go b/fuzzing/packet/gen_initial_corpus.go new file mode 100644 index 00000000..8ee0de11 --- /dev/null +++ b/fuzzing/packet/gen_initial_corpus.go @@ -0,0 +1,107 @@ +package main + +import ( + "fmt" + "log" + "os" +) + +func main() { + tests := []struct { + testNum int + input []byte + wantFail bool + expected interface{} + }{ + { + // Proper packet + testNum: 1, + input: []byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // Marker + 0, 19, // Length + 4, // Type = Keepalive + + }, + wantFail: false, + }, + { + // Invalid marker + testNum: 2, + input: []byte{ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, // Marker + 0, 19, // Length + 4, // Type = Keepalive + + }, + wantFail: true, + }, + { + // Proper NOTIFICATION packet + testNum: 3, + input: []byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // Marker + 0, 21, // Length + 3, // Type = Notification + 1, 1, // Message Header Error, Connection Not Synchronized. + }, + wantFail: false, + }, + { + // Proper OPEN packet + testNum: 4, + input: []byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // Marker + 0, 29, // Length + 1, // Type = Open + 4, // Version + 0, 200, //ASN, + 0, 15, // Holdtime + 10, 20, 30, 40, // BGP Identifier + 0, // Opt Parm Len + }, + wantFail: false, + }, + { + // Incomplete OPEN packet + testNum: 5, + input: []byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // Marker + 0, 28, // Length + 1, // Type = Open + 4, // Version + 0, 200, //ASN, + 0, 15, // Holdtime + 0, 0, 0, 100, // BGP Identifier + }, + wantFail: true, + }, + { + testNum: 6, + input: []byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // Marker + 0, 28, // Length + 2, // Type = Update + 0, 5, 8, 10, 16, 192, 168, 0, 0, // 2 withdraws + }, + wantFail: false, + }, + { + testNum: 7, + input: []byte{ + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // Marker + 0, 28, // Length + 5, // Type = Invalid + 0, 5, 8, 10, 16, 192, 168, 0, 0, // Some more stuff + }, + wantFail: true, + }, + } + for i, t := range tests { + f, err := os.Create(fmt.Sprintf("corpus/%v.bytes", i)) + if err != nil { + log.Fatalf(err.Error()) + } + f.Write(t.input) + f.Close() + } +} diff --git a/protocols/bgp/packet/fuzzing.go b/protocols/bgp/packet/fuzzing.go new file mode 100644 index 00000000..7428662d --- /dev/null +++ b/protocols/bgp/packet/fuzzing.go @@ -0,0 +1,25 @@ +// +build gofuzz + +package packet + +import "bytes" + +const ( + INC_PRIO = 1 + KEEP = 0 + DISMISS = -1 +) + +func Fuzz(data []byte) int { + + buf := bytes.NewBuffer(data) + msg, err := Decode(buf) + if err != nil { + if msg != nil { + panic("msg != nil on error") + } + return KEEP + } + + return INC_PRIO +} -- GitLab