Buffer Overflow in smblib.c
A local buffer overflow in Squid's smblib.c functions Smb_Connect() and Smb_Connect_Server() occurs because SMB domain controller names from user input are copied into an array without bounds checking. An attacker could achieve code execution and disclose credential hashes.
Originally disclosed on HackerOne
- Triaged in 5 days
- Fixed in 21 months
- Disclosed after 21 months
Summary:
In Squid 4.8, a local buffer overflow vulnerability exists in the Smb_Connect() and Smb_Connect_Server() functions of Squid's smblib.c, in which an attacker can achieve code execution that can result in the disclosure of credential hashes. The cause of this overflow is due to the SMB domain controller names being passed down from user input and eventually into an array without performing appropriate bounds checking on said array.
I submitted a patch, which was accepted and merged, which can be found here: https://github.com/squid-cache/squid/pull/494
Disclosure Timeline
15/10/19 - Initial discovery and disclosure to the Squid team via squid-bugs private email list 16/10/19 - Acknowledgement of the vulnerability by the Squid team 17/10/19 - I volunteered to fix the issue, and create a pull request on Github (See above link) 17-19/10/19 - The fix was reviewed, accepted, then merged (Fix is also backported to older Squid Versions) 23/10/19 - CVE-2019-18353 assigned
To Note
Due to the fact that this is a local (as opposed to remote) overflow, and used primarily by squid auth helpers for downgrading (As pointed out by a member of the squid team when he said an advisory would not be released because of the 'nature' of what the squid helpers are doing); I am setting the severity as medium and not expectant for a bounty.
Impact
Code execution resulting in the retrieval of credential hashes
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely missing bounds checking when copying user-supplied SMB domain controller names into a fixed-size array.
Impact
Code execution could result in the retrieval of credential hashes, though the overflow is local and primarily used by Squid auth helpers for downgrading.
What the attacker needed
Local access to the system; Squid 4.8 with SMB auth helpers
The fix
The vulnerability was fixed by a patch that was accepted and merged, and backported to older Squid versions.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A buffer overflow happens when a program writes more data into a fixed-size memory space than it can hold, spilling into nearby memory. Here, a part of Squid that handles SMB authentication takes a name from user input and copies it into a small array without checking the length, so an attacker who can supply a long name may overwrite memory and run their own code. This is a local issue, meaning the attacker needs some access to the system already.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.