GitHub Security Patch: Markdown Preview Vulnerabilities Exposed to DOM Clobbering Attacks
GitHub has urgently patched a series of HTML filter bypasses in its Markdown preview feature, a vulnerability that could have allowed attackers to execute arbitrary scripts. The flaw, a reflected script injection for normal users and a stored one for staff, was exploitable through a technique known as DOM clobbering. Attackers could craft malicious HTML snippets, such as a form element with a specific name attribute, to bypass existing sanitization and trigger JavaScript execution when the preview was rendered. This security fix has already been deployed across the platform.
The vulnerability was discovered through DOMPurify's test suite, highlighting a critical oversight in the platform's client-side sanitization logic. The patches address multiple vectors, including the primary DOM clobbering bypass, filtering for customized built-in elements using the `is` attribute, and edge cases involving `<img>` tags without a `src` attribute and `<a>` tags without an `href`. For defense in depth, GitHub has also implemented the modern HTML Sanitizer API where it is available in browsers.
While the immediate threat has been neutralized, the incident underscores the persistent risk of client-side injection attacks in complex web applications that parse and render user-generated content. The deployment of the HTML Sanitizer API represents a proactive step toward a more robust security posture, but the discovery via an external test suite suggests ongoing scrutiny of GitHub's code sanitization processes is warranted. The fix protects both regular users and staff, who faced a higher-risk stored XSS scenario.