Mitsubishi Electric Corporation MELSEC iQ-F FX5U MELSOFT Direct memory corruption vulnerability
A stack-based buffer overflow exists in the MELSOFT Direct protocol of the Mitsubishi Electric MELSEC iQ-F FX5U PLC. An attacker can send a specially crafted UDP packet to overflow a stack buffer, causing denial of service and potentially remote code execution.
Originally disclosed on Cisco Talos
A memory corruption vulnerability exists in the MELSOFT Direct functionality of Mitsubishi Electric Corporation MELSEC iQ-F FX5U v1.240 and v1.260. A specially crafted network packet can lead to a buffer overflow.
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
The vulnerable function copies an attacker-controlled filepath into a fixed-size stack buffer using an attacker-controlled length, without validating that the length fits the buffer.
Impact
The overflow can cause a denial of service in the RTOS task handling MELSOFT Direct and potentially allow remote code execution.
What the attacker needed
Network access to UDP port 5560
The fix
The vendor released a patch; the underlying fix should validate the filepath length before copying it into the fixed-size stack buffer.
How it was found
- Send a MELSOFT Direct packet to UDP port 5560 with feature set 0xC and sub-feature 0x10 or 0x11.
- Include a filepath and filepath_length in the packet body that exceed the size of the local filename buffer.
- The device copies the oversized filepath into the stack buffer, causing a buffer overflow.
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.
This is a memory corruption bug in an industrial controller. The device copies data from a network packet into a fixed-size space on its stack without checking the length, so a long packet can overwrite nearby memory. This can crash the device or, in the worst case, let an attacker run their own 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.