-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsoundness in raw_cksum #39
Comments
Here is my Poc
Rrsult
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, thank you for your contribution in this project, I an testing our static analysis tool in github's Rust project and I notice the following code:
kytan/src/packet.rs
Line 62 in f54b2f8
The issue is in udptcp_cksum where it calculates l4_len based on the IP header's total_length field without validating that this matches the actual size of the provided l4 object:
let l4_len = (u16::from_be(ip.total_length) as usize) - mem::size_of::<Ipv4Header>();
Then raw_cksum uses this potentially incorrect length to read memory:
If total_length is manipulated to be larger than the actual size of the l4 object, this will read beyond the bounds of the object, causing undefined behavior. Although it is a private function, I notice a possible way to call this function from a pub function
udptcp_cksum
.pub fn udptcp_cksum -> fn raw_cksum
Poc
The text was updated successfully, but these errors were encountered: