Skip to content

Commit

Permalink
SMTP smuggling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Dec 28, 2023
1 parent d5949da commit 5785ea1
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions src/request/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,67 @@ mod tests {
vec!["\r\na\rb\nc\r\n.d\r\n..\r\n", "\r\n.\r\n"],
"\r\na\rb\nc\r\nd\r\n.\r\n",
),
// Test SMTP smuggling attempts
(
vec![
"\n.\r\n",
"MAIL FROM:<hello@world.com>\r\n",
"RCPT TO:<test@domain.com\r\n",
"DATA\r\n",
"\r\n.\r\n",
],
concat!(
"\n.\r\n",
"MAIL FROM:<hello@world.com>\r\n",
"RCPT TO:<test@domain.com\r\n",
"DATA\r\n",
),
),
(
vec![
"\n.\n",
"MAIL FROM:<hello@world.com>\r\n",
"RCPT TO:<test@domain.com\r\n",
"DATA\r\n",
"\r\n.\r\n",
],
concat!(
"\n.\n",
"MAIL FROM:<hello@world.com>\r\n",
"RCPT TO:<test@domain.com\r\n",
"DATA\r\n",
),
),
(
vec![
"\r.\r\n",
"MAIL FROM:<hello@world.com>\r\n",
"RCPT TO:<test@domain.com\r\n",
"DATA\r\n",
"\r\n.\r\n",
],
concat!(
"\r.\r\n",
"MAIL FROM:<hello@world.com>\r\n",
"RCPT TO:<test@domain.com\r\n",
"DATA\r\n",
),
),
(
vec![
"\r.\r",
"MAIL FROM:<hello@world.com>\r\n",
"RCPT TO:<test@domain.com\r\n",
"DATA\r\n",
"\r\n.\r\n",
],
concat!(
"\r.\r",
"MAIL FROM:<hello@world.com>\r\n",
"RCPT TO:<test@domain.com\r\n",
"DATA\r\n",
),
),
] {
let mut r = DataReceiver::new();
let mut buf = Vec::new();
Expand Down

0 comments on commit 5785ea1

Please sign in to comment.