https://awesomekling.substack.com/p/fuzzing-ladybird-with-tools-from
[https]
Andreas Kling
Subscribe
Sign in
Share this post
[https]
Fuzzing Ladybird with tools from Google Project Zero
awesomekling.substack.com
Copy link
Facebook
Email
Note
Other
Fuzzing Ladybird with tools from Google Project Zero
[https]
Andreas Kling
Mar 16, 2024
17
Share this post
[https]
Fuzzing Ladybird with tools from Google Project Zero
awesomekling.substack.com
Copy link
Facebook
Email
Note
Other
Share
While Ladybird does an okay job with well-formed web content, I
thought it would be useful to throw some security research tools at
it and see what kind of issues it might reveal. So today we'll be
using "Domato ", a DOM fuzzer from Google Project Zero, to stress
test Ladybird and fix some issues found along the way.
The way this works is that Domato generates randomized web pages with
lots of mostly-valid but strange HTML, CSS and JavaScript. I then
load these pages into a debug build of Ladybird and observe what
happens.
[https]
Domato generates HTML pages of roughly 500 KiB in size, filled with
"interesting" JS, CSS and HTML to surprise and delight your browser
engine!
The Domato README boasts a ton of bugs discovered in all major
browsers, so I have no doubt it will find some in ours as well. Here
we go!
Issue #1:
inside
Unsurprisingly, it took less than a second to find the first issue!
The output produced by Domato is actually 562 KiB, but I was able to
reduce it to the following:
I've compiled Ladybird with UBSAN (Undefined Behavior SANitizer) for
this test, and I get the following very helpful trace output:
LibWeb/HTML/HTMLTableCellElement.cpp:55:36: runtime error: member call on null pointer of type 'Web::DOM::Node'
#0 0x7e9bfa1610dd in table_containing_cell LibWeb/HTML/HTMLTableCellElement.cpp:55:36
#1 0x7e9bfa1610dd in Web::HTML::HTMLTableCellElement::apply_presentational_hints(Web::CSS::StyleProperties&) const LibWeb/HTML/HTMLTableCellElement.cpp:101:33
#2 0x7e9bf97c22d1 in Web::CSS::StyleComputer::compute_cascaded_values(Web::CSS::StyleProperties&, Web::DOM::Element&, AK::Optional, bool&, Web::CSS::StyleComputer::ComputeStyleMode) const LibWeb/CSS/StyleComputer.cpp:1448:17
#3 0x7e9bf97e5899 in Web::CSS::StyleComputer::compute_style_impl(Web::DOM::Element&, AK::Optional, Web::CSS::StyleComputer::ComputeStyleMode) const LibWeb/CSS/StyleComputer.cpp:2231:5
#4 0x7e9bf97e447e in Web::CSS::StyleComputer::compute_style(Web::DOM::Element&, AK::Optional) const LibWeb/CSS/StyleComputer.cpp:2202:12
#5 0x7e9bf9a7e60c in Web::DOM::Element::recompute_style() LibWeb/DOM/Element.cpp:575:64
It's a good old-fashioned null pointer dereference!
As it turns out, we've implemented