Skip to content
Memory corruption Advisory Advanced CVE-2022-29496

Blynk Blynk-Library BlynkConsole.h runCommand stack-based buffer overflow vulnerability

The runCommand function in Blynk-Library copies an unbounded number of space-separated arguments into a fixed eight-element stack array, so a crafted command with many spaces overflows the stack. An attacker sending such a network request could overwrite the return address and, on architectures where the argument data is executable, run arbitrary code.

Francesco Benvenuto Follow

Originally disclosed on Cisco Talos

Critical 9.0 View original

A stack-based buffer overflow vulnerability exists in the BlynkConsole.h runCommand functionality of Blynk -Library v1.0.1. A specially-crafted network request can lead to command execution.

Francesco Benvenuto, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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 split_argv helper writes argument pointers into the caller's fixed-size argv array without knowing its length or bounding the number of arguments.

Impact

A crafted network request could overwrite the return address and, depending on the architecture, lead to arbitrary command execution on the embedded device.

What the attacker needed

Network access to the device; command handled by runCommand; executable argument memory (architecture-dependent)

How it was found

  1. Send a command to the device that is handled by runCommand.
  2. Include more than seven spaces so split_argv produces more arguments than the array holds.
  3. The extra argument pointers overwrite the saved return address of runCommand.
  4. If the architecture allows execution of the argument data, that data is executed.

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.

The library splits an incoming command into words and stores a pointer to each word in a small fixed list on the stack. It never checks how many words arrive, so a command with many spaces writes past the end of that list and can overwrite the saved return address, which tells the device where to continue after the function finishes. If that memory can be executed, the attacker's data may run as code.

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 Francesco Benvenuto

View all

152 more disclosed reports, best first.

More from Cisco Talos

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.