Microlight.js Null Pointer Dereference Vulnerability

Vulnerability

A null pointer dereference vulnerability exists in Microlight.js version 0.0.7, a lightweight syntax highlighting library. The issue arises when the library processes elements with non-standard CSS color values. It fails to validate the outcome of a regular expression match before accessing its properties, which leads to an uncaught TypeError and a potential application crash. This vulnerability can cause a denial-of-service condition by crashing browser tabs running applications that use Microlight.js, creating unstable user experiences, and potentially leading to data loss if a user has unsaved work in the affected browser tab.

Impact

Exploitation of this vulnerability causes a denial-of-service condition, leading to an application crash.

Reproduction

To reproduce this vulnerability, create HTML elements with the 'microlight' class and set their CSS color property to non-standard values that do not match the expected RGB or RGBA format, such as 'transparent', 'inherit', 'initial', 'unset', 'none', or 'invalidcolor'. After applying these color values, call the 'microlight.reset()' function to trigger the highlighting process. The absence of a crash indicates that the vulnerability has not been successfully exploited.

Remediation

The vulnerability can be addressed by adding proper validation for the 'colorArr' variable before accessing its properties. The updated code should include a default value in case the regular expression match fails.

Added: Jun 17, 2025, 8:20 PM
Updated: Jun 17, 2025, 8:54 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
2.5
exploitability
8.7
remediation
0.0
relevance
0.2
threat
6.4
urgency
2.9
incentive
5.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.