| Summary: | 2 integer overflows in function ssh_packet_send2_wrapped() | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Torben <Torben.Hansen.2015> | ||||||
| Component: | ssh | Assignee: | Damien Miller <djm> | ||||||
| Status: | CLOSED FIXED | ||||||||
| Severity: | minor | CC: | djm | ||||||
| Priority: | P5 | ||||||||
| Version: | 7.2p1 | ||||||||
| Hardware: | 68k | ||||||||
| OS: | Mac OS X | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 2543 | ||||||||
| Attachments: |
|
||||||||
|
Description
Torben
2016-05-02 21:16:51 AEST
Created attachment 2813 [details]
check padding calculations
Hi,
Thanks for the report. I think we can avoid these by promoting the padding calculation variables' types from u_char to u_int and dropping in a few checks. This patch implements this.
It's currently cranking through our regression tests...
Hi Damien, This patch would prevent any integer overflows. But by promoting padlen to u_int you now open up for the possibility of having padlen > 255 (which do happen for the same values that would make the variable wrap in the first case). I'm not sure what consequences it has for the execution of the code following the extra padding computation. It is nonetheless illegal to have more than 255 bytes of padding according to RFC 4253 section 6. Checking if padlen + pad > 255 (instead of just pad > 255) would prevent this problem. Cheers, Torben Created attachment 2853 [details]
revised diff
revised diff; check each operation in padding calculation for overflow
I've committed the revised patch, this will be in OpenSSH 7.3 which is due to be released in the next couple of weeks. Close all resolved bugs after 7.3p1 release |