-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from zkemail/audit/fix-bh-access
veredise audit fix: bh= may occur in other DKIM tags
- Loading branch information
Showing
3 changed files
with
46 additions
and
10 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
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 |
---|---|---|
|
@@ -167,6 +167,14 @@ mod header_field_access { | |
let _ = get_body_hash(dkim_field, malicious_sequence, malicious_body_hash_index); | ||
} | ||
|
||
#[test(should_fail_with = "No 'bh=' prefix found at asserted bh index")] | ||
fn test_malicious_body_hash_index() { | ||
// tests against "dkim-signature: v=1; a=rsa-sha256; d=example.com; s=selector; c=relaxed/relaxed; q=dns/txt; t=1683849600; x=1684454400; h=from:to:subject:date; z=From:[email protected]|To:[email protected]|Subject:Hello|Date:Thu, 11 May 2023 15:00:00 -0700; bh=2jUSOH9NhtVGCaWpZT2ncBgaamXkef9OgICHkqfsmKY=; b=" | ||
let (header, body_hash_index) = EmailLarge::tampered_dkim_field(); | ||
let sequence: Sequence = Sequence { index: 0, length: header.len() }; | ||
let _ = get_body_hash(header, sequence, body_hash_index); | ||
} | ||
|
||
#[test(should_fail_with = "Header field must end with CRLF")] | ||
fn test_header_field_sequence_overflow_end() { | ||
// make sequence extend beyond the end of the header field | ||
|
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