Qt Project Qt QML QtScript Reflect API integer overflow vulnerability
An integer overflow in Qt's QML QtScript Reflect API allows a specially crafted JavaScript array length to cause memory corruption during allocation. An attacker could exploit this to achieve arbitrary code execution if the target application loads a malicious web page.
Originally disclosed on Cisco Talos
An integer overflow vulnerability exists in the QML QtScript Reflect API of Qt Project Qt 6.3.2. A specially-crafted javascript code can trigger an integer overflow during memory allocation, which can lead to arbitrary code execution.
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 length of an array-like object is stored in a signed integer and used directly in pointer arithmetic without checking for overflow, so a large length causes the allocation size to wrap around.
Impact
This could lead to arbitrary code execution, but the target application must access a malicious web page to trigger the vulnerability.
What the attacker needed
Victim visits a malicious web page; application uses Qt QML QtScript
The fix
The vulnerability was fixed by the vendor in a patch release.
How it was found
- Create an empty array and a second array.
- Set the second array's length property to a very large number.
- Call Reflect.apply with the reverse method of the first array, the first array as the target object, and the second array as the arguments list.
- The call triggers an integer overflow during memory allocation, leading to a crash or memory corruption.
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.
When a program allocates memory for a list, it multiplies the number of items by the size of each item. If that number is very large, the multiplication can wrap around to a small value, so the program allocates too little memory but then writes more data than fits, corrupting memory. This can 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.