Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ lazy_static = "1.4.0"
tokio-rustls = { version = "0.20", optional = true }
openssl = { version = "0.10.30", optional = true }
tokio-openssl = { version = "0.5", optional = true }
tokio = { version = "0.3", features = ["net", "io-util", "stream", "rt-multi-thread", "macros"] }
tokio = { version = "0.3", features = ["net", "io-util", "stream", "rt-multi-thread", "macros", "fs"] }
socket2 = "0.3.19"
cookie = { version = "0.14.3", optional = true }
serde = { version = "1.0.123", optional = true }
serde_json = { version = "1.0.59", optional = true }

Expand All @@ -34,14 +33,15 @@ test_crate = []
raw_headers = []
query_strings = []
extended_queries = []
cookies = ["cookie"]
cookies = []
json = ["serde", "serde_json"]
url_variables = []
rustls = ["tokio-rustls"]
openSSL = ["openssl", "tokio-openssl"]
# exposes the parsers to the fuzz targets in octane_http/fuzz, not a stable API
fuzzing = []

[dev-dependencies]
reqwest = { version = "0.10.8", features = ["native-tls"] }
tokio = { version = "0.3", features = ["net", "io-util", "rt-multi-thread", "macros"] }
curl = "0.4.33"

Expand Down
54 changes: 54 additions & 0 deletions octane_http/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ tokio = { version = "0.3", features = ["io-util", "rt"] }
[dependencies.octane_http]
path = ".."

# the second-stage parsers and the full request path, built with octane's
# default features
[dependencies.octane]
path = "../.."
features = ["fuzzing", "extended_queries"]

[features]
# the http2 targets need octane_http's http2 module, which isn't committed yet
http2 = []

# Keep this crate out of the parent workspace so cargo-fuzz can build it
# with its own (sanitizer-instrumented) profile.
[workspace]
Expand Down Expand Up @@ -41,17 +51,61 @@ path = "fuzz_targets/http2_frame.rs"
test = false
doc = false
bench = false
required-features = ["http2"]

[[bin]]
name = "http2_hpack"
path = "fuzz_targets/http2_hpack.rs"
test = false
doc = false
bench = false
required-features = ["http2"]

[[bin]]
name = "quic"
path = "fuzz_targets/quic.rs"
test = false
doc = false
bench = false

[[bin]]
name = "request_line"
path = "fuzz_targets/request_line.rs"
test = false
doc = false
bench = false

[[bin]]
name = "headers"
path = "fuzz_targets/headers.rs"
test = false
doc = false
bench = false

[[bin]]
name = "path"
path = "fuzz_targets/path.rs"
test = false
doc = false
bench = false

[[bin]]
name = "query"
path = "fuzz_targets/query.rs"
test = false
doc = false
bench = false

[[bin]]
name = "cookie"
path = "fuzz_targets/cookie.rs"
test = false
doc = false
bench = false

[[bin]]
name = "request"
path = "fuzz_targets/request.rs"
test = false
doc = false
bench = false
33 changes: 33 additions & 0 deletions octane_http/fuzz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Fuzzing

A cargo-fuzz crate for Octane's HTTP/1.x parsing, from the raw head splitter
in `octane_http` to the full request path in `octane`. It has its own
`[workspace]` so it stays out of the main workspace, and it needs nightly.

```sh
cd octane_http
cargo +nightly fuzz run request # until it finds something
cargo +nightly fuzz run cookie -- -max_total_time=300 # for five minutes
```

| Target | Fuzzes | Checks |
|---|---|---|
| `http1x_parse` | `RawRequest1x::parse` | fields are non-empty sub-slices of the input that rebuild it |
| `http1x_read` | `Http1xReader`, reads of 1 to 17 bytes | chunking never changes how the head is split |
| `request_line` | the request-line parser | normalised path, query kept apart, method and version read exactly |
| `headers` | the header block and `Content-Length` | well formed fields, repeats merged in order, RFC 9112 section 6.3 body length |
| `path` | `.` and `..` normalisation | never above the root, idempotent |
| `query` | query strings and the component decoder | named pairs kept, the decoder inverts `%XX` and form encoding |
| `cookie` | `Cookie` header parsing and `Set-Cookie` building | token names, no control characters, round trips, attributes kept, browser rules |
| `request` | one connection through the whole server | exactly one well framed response, no header the app didn't set |
| `http2_frame`, `http2_hpack` | HTTP/2 framing and HPACK | need `--features http2` and the `http2` module, which isn't committed yet |
| `quic` | nothing yet | placeholder |

The targets for the `octane` crate go through its `fuzzing` feature
(`src/fuzzing.rs`), which exposes the internal parsers and serves a
connection from memory. They assume octane's default features, `faithful`
in particular.

`corpus/<target>/` holds the inputs each target starts from, and crashes are
saved to `artifacts/<target>/`. Replay one with
`cargo +nightly fuzz run <target> artifacts/<target>/<file>`.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_=e~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hot-------------------t-------------=2`_
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!b2"p="򽆆; ";="2𽆆;";="1򽆆;"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^^^^=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
___o777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777077777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777w777777777777777777777777777777777777777777777777HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH7777777777777777777777777777777w777___o7777777777777777777777777777777777777777777777VVVVVVVVVVVVVVVVVVVV.VVVVVVVVVVVVVVVVVVVVVVVVV7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777077777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777W77777777777777777777777777777777777777777777777777777777777777777777#s#od=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_,_1
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1=;*c=
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Hoc-id=v; _Hi-otdc= =
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~a=廁>:>>>>&b>>>廁_c>>>廁a=廁>:>>KKKKK1K>>&b>>廁_c>>>>廁a>>>廁a=廁>:>>KK>b>>>1廁_c>>>>廁a=廁a=廁>:>>>>廁_c>>>>廁a=廁>:c>>>廁_cc?
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
___o7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777077777777777777777777777777777777777777777777777777777777777777777'77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777w777777777777777777777777777777777777777777777777HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH7777777777777777777777777777777w777___o7777777777777777777777777777777777777777777777VVVVVVVVVVVVVVVVVVVV.VVVVVVVVVVVVVVVVVVVVVVVVV77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777077777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777W77777777777777777777777777777777777777777777777777777777777777777777#s#od=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ao="=1; b="=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-d3__id=so___
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
n=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--------=
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~H=0?_a
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Èoc2t-ida=1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
___o77777777777777777777777777777777777777777777777777777777777777777777777777777___o777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777#s#od=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oÄ„ÿÿ$ÿÿ
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2!!=ÿuc!
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_a=;Q'ca=;0=;;'=;b'a=;;;Q'ca=;0=;;'=;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_H5$Cbc''a=;1b'ca=b?=;1b'cc'''ca=;1b"a?=;1b'ca=;1fny%=*);|=3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
鏠=鏠
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dÃÎÄ•ŒÄžá":1{=1}=A-f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__2=0_Hos__H1666a=-1;*+b=6610_Hos__H6a=-1;*+b=66oct_HoH16666a=-1;*+b=67to___-id=o_-i_d0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Host-Ùa
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c=""ooooooooooob="";=""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__7_o7777777777777777777777777777777777777770199540785656!77777777777777777700000007211644586663803101OOOOOOOOOOOOOO777777777777777777777777777777000000000000001354047645OOOOOOOOOOOOOO77777777777777777777777777777777777777777777777777777777777777777777777od=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f2"c†2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Hoct-ida=1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
򽆆;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Hoc_H-id=oct; __Hi-%%0$%-id={v; __Hi-o%t&!%-$%%Hi-={v; __Hi-~t~&!=
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_-d=NNNNNNNNNN_s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1ÿÿ0ÿÿe3ÿ
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__ostËst Notr ÈÈ_s-
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
H""á_s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
```````````````````da!!!0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$=t=0;__Hostut==0;__Host.=;__Host_Xut=0;__Host.=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
____=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a=1;*+b="*";*+b="*";!=>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
||||||||||||||||s=*
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
t=ÚÚÞs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Host-1Hÿ+þ2HH;__H
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a=1;__Hoctd=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_%%$47&%&%%'%%%%&%%%7&%&%%%%'%%%%&%%%%%so%%%so%%_%=_
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b=*
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
..=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
;js=1;;_H=1;js=0;{;&s=2;{;js=1;e=H=1;js=0;{;&s{;js=1;H=_;1;js=;js=1;e=H=1;js=0;{;&s=2;%0;{;&s=2;{;js=1;=1;js=0;{;&s=2;{;js=1;e=ff
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
""; c=""b=""; c="""""; c=""b="";
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_!_ŠŠŠŠ_Š=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
****************i=_
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
鏠=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Hos^~^s^__Hosny-%^=);j__s^^^^*|sn=-
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oH=__a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$$$$=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=;;;;; b=;0;;; c=31;;;2;3
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
&b="a==1; b1; b##==h; b="a==1; b="0"a5=;1=b1"; b="a==1; b="0"a5=;1=b1""1=; b="a==1; b="0"a==;1=b "1""1""_"1=; b="a==1; b="0"a==;b="0"a5=;1=b1"; b="a==1; b="0"a5=;1=b1""1=; b="a==1; b="0"a==;1=b "1""1""_"1=; b="a==1; b="0"a==;1=b "1""1""_;1=b "1""1""_;="2"H
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++a=;]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__Hoct-iœÂÎÄþÿÿÿÿÿÿ
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
+________________________________b=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
........=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^^=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a=1 c=2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
O=́
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~~~~~~~~H=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
O2򽆆-=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_=*.Õ‚;f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_O0aã SSSS SSSSScccccc!cccbcCckccÏcccccc {#cca=
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
;;;;;;;;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a===b=""; ==b["a===b=""; c==b[""; c=""b=""; c=""ooooooooooob=""; c=""b=""; c=""ooooooooo2ooo^oooooooob="";c==""b=""; c=""ooooooooooob=""; c=""b=""; c=""oooooooo+"; c=""b=""; c=""ooooooooooob=""; c=""b=""; co2ooo^oooooooobc==b["a===b=""; c==b[""; c=""b=""; c=""ooooooooo"a===b=""; c==b[""; c=""b=""; c=""ooooooooooob=""; c=""b=""; c=""ooooooooo2ooo^oooooooob="";c==""b=""; c=""ooooooooooob=""; c=""b=""; c=""oooooooo+"; c=""b=""; c=""ooooooooooob=""; c=""b=""; co2ooo^oooooooobc==b["a="ooooooooo2ooo^oooooooob="";c==""b=""; c=""ooooooooooob=""; c=""b=""; c=""oooooooo+"; c=""b=""; c=""ooob=""; c=""b=""; c=""ooooooooo2ooo^oooooooob="";c==""b=""; c=""ooooooooooob=""; c=""b=""; c=""oooooooo+"; c=""b=""; c=""ooooooooooob=""; c=""b=""; co2ooo^oooooooob="";c==""b=""; c=""ooooooooooob=""; c=""b=""; c=""ooooooooo2ooo^oooooooob="";c=""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= 0
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
___H_d=0_Hos__H1666a=-1;*+b=ct_Hos__H166s__H1666a=-1;*+b=66t666a=66oct_Hos_1666a=-1;*+b=66oct_Ho35a=-1;*+b=66oct_Ho6a=66oct_Hos_1666a=-1;*+b=66oct_Hos__H10_Hos__H6434a=-1;*+b=66oct_Hos__H1666a=-1?*+bA66t666a=-1;*+b=66to_-is___Hos__H1666a=-1;*+b=ct_Hos__H1666aa=-1;*+b=66to_-isO_-id=;*+b=66oct_Hos__H1666a=-1;*+b=66t666a=66oct_Hos_1666a=-1;%*+b=66oc&&=t_Hos__H10_Hos__H6434a=-1;*+b=66oct_Hos__H1666a=-1?*+b=66t666a=-1;*+b=66to_-is__-id=o_-is__-id=0a=-1;-id=o_-is__-id=0a
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_s_́b&=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__H_.Hoct-iz¿Œo_=f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_ssGÿsssssssst-oosssssosß_0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__o_Hc-t_Hi_o_Hc-t_Hid=sd=s_ D_ sd=s_ d=e=f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
廁_-d=1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_OaãSS+ccccgcSSSSSScccccccccOOOO_H0aOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOa=O=ONOOO
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
="";="2"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__;O2򽂆 =
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
^^^^^^^^=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
___Hoct-id=sop_n={"=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_dddggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg__H__=H
Loading
Loading