forked from trussed-dev/fido-authenticator
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fuzz target sends a sequence of arbitrary CTAP1 or CTAP2 requests to the authenticator.
- Loading branch information
1 parent
79b05b5
commit 0a91cb7
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target | ||
corpus | ||
artifacts | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[package] | ||
name = "fido-authenticator-fuzz" | ||
version = "0.0.0" | ||
publish = false | ||
edition = "2021" | ||
|
||
[package.metadata] | ||
cargo-fuzz = true | ||
|
||
[dependencies] | ||
ctap-types = { version = "0.2.0", features = ["arbitrary"] } | ||
libfuzzer-sys = "0.4" | ||
trussed-staging = { version = "0.3.0", features = ["chunked", "hkdf", "virt"] } | ||
|
||
[dependencies.fido-authenticator] | ||
path = ".." | ||
|
||
[[bin]] | ||
name = "ctap" | ||
path = "fuzz_targets/ctap.rs" | ||
test = false | ||
doc = false | ||
bench = false | ||
|
||
[patch.crates-io] | ||
ctap-types = { git = "https://github.com/trussed-dev/ctap-types.git", branch = "arbitrary" } | ||
littlefs2 = { git = "https://github.com/trussed-dev/littlefs2.git", rev = "2b45a7559ff44260c6dd693e4cb61f54ae5efc53" } | ||
trussed = { git = "https://github.com/trussed-dev/trussed.git", rev = "b548d379dcbd67d29453d94847b7bc33ae92e673" } | ||
trussed-chunked = { git = "https://github.com/trussed-dev/trussed-staging.git", tag = "chunked-v0.1.0" } | ||
trussed-hkdf = { git = "https://github.com/trussed-dev/trussed-staging.git", tag = "hkdf-v0.2.0" } | ||
trussed-staging = { git = "https://github.com/trussed-dev/trussed-staging.git", tag = "v0.3.0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#![no_main] | ||
|
||
use ctap_types::{authenticator::Request, ctap1::Authenticator as _, ctap2::Authenticator as _}; | ||
use fido_authenticator::{Authenticator, Config, Conforming}; | ||
use trussed_staging::virt; | ||
|
||
use libfuzzer_sys::fuzz_target; | ||
|
||
fuzz_target!(|requests: Vec<Request<'_>>| { | ||
virt::with_ram_client("fido", |client| { | ||
let mut authenticator = Authenticator::new( | ||
client, | ||
Conforming {}, | ||
Config { | ||
max_msg_size: 0, | ||
skip_up_timeout: None, | ||
max_resident_credential_count: None, | ||
large_blobs: None, | ||
nfc_transport: false, | ||
}, | ||
); | ||
|
||
for request in requests { | ||
match request { | ||
Request::Ctap1(request) => { | ||
authenticator.call_ctap1(&request).ok(); | ||
} | ||
Request::Ctap2(request) => { | ||
authenticator.call_ctap2(&request).ok(); | ||
} | ||
} | ||
} | ||
}); | ||
}); |