Skip to content

Add advisory for eventsource-stream panic on a leading byte order mark - #3708

Open
ninadphalak wants to merge 1 commit into
rustsec:mainfrom
ninadphalak:eventsource-stream-bom-panic
Open

ninadphalak wants to merge 1 commit into
rustsec:mainfrom
ninadphalak:eventsource-stream-bom-panic

Conversation

@ninadphalak

Copy link
Copy Markdown

Affected crate(s)

  • eventsource-stream (about 19.1 million recent downloads per crates.io)

Links to upstream issue(s) or PR(s)

I did not find this bug. I am filing the advisory so that cargo audit users are warned: the latest release is from February 2022 and the repository has had no maintainer activity since August 2024.

Severity

Remote denial of service by panic. A stream that starts with a UTF-8 byte order mark, which the event stream format allows, panics in the task that polls the parser. No memory unsafety.

I reproduced it on 0.2.3:

use eventsource_stream::Eventsource;
use futures::{executor::block_on, stream, StreamExt};

fn main() {
    let body: Vec<u8> = b"\xEF\xBB\xBFdata: hello\n\n".to_vec();
    let s = stream::iter(vec![Ok::<_, std::io::Error>(body)]);
    let events: Vec<_> = block_on(s.eventsource().collect());
    println!("{}", events.len());
}
panicked at src/event_stream.rs:271:36:
start byte index 1 is not a char boundary; it is inside '\u{feff}' (bytes 0..3 of string)

The slicing code is present from 0.2.0 on. The 0.1.x sources have no byte order mark handling, so I marked them unaffected.

Checklist

  • Advisory filename(s) starts with RUSTSEC-0000-0000 as the ID
  • date field is set to the public disclosure date (the date of the upstream pull request)
  • Contains a concise and descriptive title after advisory metadata
  • Asked maintainer(s) if publishing an advisory is appropriate

On the last box: I have not asked the maintainer directly. He has not answered the upstream pull request, or the request for review on it, in ten months. If you want an upstream issue asking first, or would rather have this as an unmaintained notice, tell me and I will do that.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant