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

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.

Emma Reuter Follow

Originally disclosed on Cisco Talos

High 8.8 View original

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.

Emma Reuter and Theo Morales, 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 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

  1. Create an empty array and a second array.
  2. Set the second array's length property to a very large number.
  3. 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.
  4. 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.

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.