Skip to content
Memory corruption Disclosed report Intermediate

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.

ammm Follow

Originally disclosed on HackerOne

High 8.1 View original
  • 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:

  1. Create a .xml file with a correct XML format
  2. Introduce a big XML field that overflows "encodingStr" buffer.
  3. 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.

The original report as published on HackerOne, by ammm. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. Create a valid XML file.
  2. Add a large XML field that overflows the encoding buffer.
  3. 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.

More by ammm

View all

1 more disclosed report, best first.

More from Notepad++

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.