Stack overflow in XML Parsing
A stack buffer overflow exists in Notepad++'s XML parsing code because a fixed-size character buffer is filled without checking its boundaries. An attacker could craft a malicious XML file that crashes the application when opened.
- Triaged in 5 hours
- Fixed in 16 days
- Paid in 16 days
- Disclosed after 7 months
Summary:
A stack buffer overflow vulnerability has been detected in XML parsing functionality on Notepad++.
That's due to the fact that _invisibleEditView.getText function doesn't check buffer boundaries.
Description: Vulnerability src file: notepad-plus-plus/PowerEditor/src/Notepad_plus.cpp Vulnerability line: line 1008 Variable affected: char encodingStr[128]; Function that overflows buffer: _invisibleEditView.getText
Steps To Reproduce:
- Create a .xml file with a correct XML format
- Introduce a big XML field that overflows "encodingStr" buffer.
- Open the file with Notepad++ and application should crash.
Supporting Material/References:
- BoF_example1.xml -> Exploit example
Impact
An attacker could create a malicious .xml file that triggers a stack buffer overflow on victim machine.
You only need to open attached .xml file example with Notepad++ to reproduce the exploit.
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 the code copies text returned by the editor view into a fixed 128-byte stack buffer without validating the length first.
Impact
An attacker could cause a crash by getting a victim to open a malicious XML file; the report only claims a crash, not code execution.
What the attacker needed
Victim opens a crafted XML file; Notepad++ installed
How it was found
- Create a valid XML file.
- Add a large XML field that overflows the encoding buffer.
- Open the file in Notepad++ and observe the crash.
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 is a small reserved space in memory for holding data. Here the program copies text from an XML file into a fixed-size space without checking whether it fits, so a long value spills over into neighbouring memory and crashes the program. Opening a crafted file is enough to trigger it.
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.