Closed Bug 1699003 Opened 3 years ago Closed 3 years ago

Assertion failure: nsContentUtils::IsSafeToRunScript(), at /builds/worker/checkouts/gecko/docshell/base/nsDocShell.cpp:1507

Categories

(Core :: DOM: Navigation, defect)

defect

Tracking

()

VERIFIED FIXED
89 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox86 --- unaffected
firefox87 --- unaffected
firefox88 + fixed
firefox89 --- fixed

People

(Reporter: tsmith, Assigned: nika)

References

(Blocks 1 open bug, Regression)

Details

(4 keywords, Whiteboard: [sec-survey])

Attachments

(3 files)

Attached file testcase.html

First reported while fuzzing m-c 20210313-6264f13d54a1

Assertion failure: nsContentUtils::IsSafeToRunScript(), at /builds/worker/checkouts/gecko/docshell/base/nsDocShell.cpp:1507

#0 0x7f5b5b31236c in nsDocShell::SetCurrentURI(nsIURI*, nsIRequest*, bool, unsigned int) src/docshell/base/nsDocShell.cpp:1507:3
#1 0x7f5b5b3301b5 in nsDocShell::CreateAboutBlankContentViewer(nsIPrincipal*, nsIPrincipal*, nsIContentSecurityPolicy*, nsIURI*, mozilla::Maybe<nsILoadInfo::CrossOriginEmbedderPolicy> const&, bool, bool, mozilla::dom::WindowGlobalChild*) src/docshell/base/nsDocShell.cpp:6866:9
#2 0x7f5b5b30ddd7 in nsDocShell::EnsureContentViewer() src/docshell/base/nsDocShell.cpp:6680:17
#3 0x7f5b5b313e7f in nsDocShell::GetDocument() src/docshell/base/nsDocShell.cpp:3289:3
#4 0x7f5b5767064e in nsFrameLoader::MarginsChanged() src/dom/base/nsFrameLoader.cpp:1042:33
#5 0x7f5b5a5215f2 in nsSubDocumentFrame::AttributeChanged(int, nsAtom*, int) src/layout/generic/nsSubDocumentFrame.cpp:811:20
#6 0x7f5b5a2f3e67 in mozilla::RestyleManager::AttributeChanged(mozilla::dom::Element*, int, nsAtom*, int, nsAttrValue const*) src/layout/base/RestyleManager.cpp:3362:19
#7 0x7f5b5a2f3ac0 in mozilla::PresShell::AttributeChanged(mozilla::dom::Element*, int, nsAtom*, int, nsAttrValue const*) src/layout/base/PresShell.cpp:4375:37
#8 0x7f5b575a0b90 in operator() src/dom/base/MutationObservers.cpp:148:3
#9 0x7f5b575a0b90 in Notify<IsRemoval::No, ShouldAssert::Yes, (lambda at src/dom/base/MutationObservers.cpp:148:3), (lambda at src/dom/base/MutationObservers.cpp:148:3)> src/dom/base/MutationObservers.cpp:99:5
#10 0x7f5b575a0b90 in mozilla::dom::MutationObservers::NotifyAttributeChanged(mozilla::dom::Element*, int, nsAtom*, int, nsAttrValue const*) src/dom/base/MutationObservers.cpp:150:3
#11 0x7f5b57540469 in mozilla::dom::Element::SetAttrAndNotify(int, nsAtom*, nsAtom*, nsAttrValue const*, nsAttrValue&, nsIPrincipal*, unsigned char, bool, bool, bool, mozilla::dom::Document*, mozAutoDocUpdate const&) src/dom/base/Element.cpp:2520:5
#12 0x7f5b5753c5d2 in mozilla::dom::Element::SetAttr(int, nsAtom*, nsAtom*, nsTSubstring<char16_t> const&, nsIPrincipal*, bool) src/dom/base/Element.cpp:2360:10
#13 0x7f5b58790a5a in SetAttr /builds/worker/workspace/obj-build/dist/include/mozilla/dom/Element.h:938:12
#14 0x7f5b58790a5a in SetAttr /builds/worker/workspace/obj-build/dist/include/mozilla/dom/Element.h:934:12
#15 0x7f5b58790a5a in SetAttr /builds/worker/workspace/obj-build/dist/include/mozilla/dom/Element.h:1573:14
#16 0x7f5b58790a5a in SetHTMLAttr src/dom/html/nsGenericHTMLElement.h:726:5
#17 0x7f5b58790a5a in SetMarginWidth /builds/worker/workspace/obj-build/dist/include/mozilla/dom/HTMLIFrameElement.h:127:5
#18 0x7f5b58790a5a in mozilla::dom::HTMLIFrameElement_Binding::set_marginWidth(JSContext*, JS::Handle<JSObject*>, void*, JSJitSetterCallArgs) /builds/worker/workspace/obj-build/dom/bindings/HTMLIFrameElementBinding.cpp:1279:24
#19 0x7f5b588d0b2f in bool mozilla::dom::binding_detail::GenericSetter<mozilla::dom::binding_detail::NormalThisPolicy>(JSContext*, unsigned int, JS::Value*) src/dom/bindings/BindingUtils.cpp:3186:8
#20 0x7f5b5b99a390 in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) src/js/src/vm/Interpreter.cpp:435:13
#21 0x7f5b5b999afc in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) src/js/src/vm/Interpreter.cpp:520:12
#22 0x7f5b5b99b2f9 in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) src/js/src/vm/Interpreter.cpp:580:10
#23 0x7f5b5b99c32e in Call src/js/src/vm/Interpreter.cpp:597:8
#24 0x7f5b5b99c32e in js::CallSetter(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::Handle<JS::Value>) src/js/src/vm/Interpreter.cpp:735:10
#25 0x7f5b5bcd742e in SetExistingProperty(JSContext*, JS::Handle<JS::PropertyKey>, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::Handle<js::NativeObject*>, JS::Handle<JS::PropertyResult>, JS::ObjectOpResult&) src/js/src/vm/NativeObject.cpp:2616:8
#26 0x7f5b5bcd64e2 in bool js::NativeSetProperty<(js::QualifiedBool)1>(JSContext*, JS::Handle<js::NativeObject*>, JS::Handle<JS::PropertyKey>, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::ObjectOpResult&) src/js/src/vm/NativeObject.cpp:2650:14
#27 0x7f5b5b98e068 in SetProperty src/js/src/vm/ObjectOperations-inl.h:282:10
#28 0x7f5b5b98e068 in SetPropertyOperation src/js/src/vm/Interpreter.cpp:272:10
#29 0x7f5b5b98e068 in Interpret(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:3009:12
#30 0x7f5b5b987311 in js::RunScript(JSContext*, js::RunState&) src/js/src/vm/Interpreter.cpp:405:13
#31 0x7f5b5b999b19 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) src/js/src/vm/Interpreter.cpp:552:13
#32 0x7f5b5b99b2f9 in InternalCall(JSContext*, js::AnyInvokeArgs const&, js::CallReason) src/js/src/vm/Interpreter.cpp:580:10
#33 0x7f5b5b99b51f in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) src/js/src/vm/Interpreter.cpp:597:8
#34 0x7f5b5bf103eb in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) src/js/src/jsapi.cpp:2856:10
#35 0x7f5b585f4e5c in mozilla::dom::EventListener::HandleEvent(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::dom::Event&, mozilla::ErrorResult&) /builds/worker/workspace/obj-build/dom/bindings/EventListenerBinding.cpp:58:8
#36 0x7f5b58c793d6 in void mozilla::dom::EventListener::HandleEvent<mozilla::dom::EventTarget*>(mozilla::dom::EventTarget* const&, mozilla::dom::Event&, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) /builds/worker/workspace/obj-build/dist/include/mozilla/dom/EventListenerBinding.h:65:12
#37 0x7f5b58c7911e in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*) src/dom/events/EventListenerManager.cpp:1108:43
#38 0x7f5b58c79da0 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) src/dom/events/EventListenerManager.cpp:1305:17
#39 0x7f5b58c6f0f5 in HandleEvent /builds/worker/workspace/obj-build/dist/include/mozilla/EventListenerManager.h:390:5
#40 0x7f5b58c6f0f5 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:354:17
#41 0x7f5b58c6e6a3 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) src/dom/events/EventDispatcher.cpp:556:16
#42 0x7f5b58c71275 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) src/dom/events/EventDispatcher.cpp:1099:11
#43 0x7f5b58c73dd6 in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) src/dom/events/EventDispatcher.cpp
#44 0x7f5b57688ed3 in nsINode::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) src/dom/base/nsINode.cpp:1332:17
#45 0x7f5b5739827a in nsContentUtils::DispatchEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, mozilla::Trusted, bool*, mozilla::ChromeOnlyDispatch) src/dom/base/nsContentUtils.cpp:4196:28
#46 0x7f5b57398106 in nsContentUtils::DispatchTrustedEvent(mozilla::dom::Document*, nsISupports*, nsTSubstring<char16_t> const&, mozilla::CanBubble, mozilla::Cancelable, mozilla::Composed, bool*) src/dom/base/nsContentUtils.cpp:4166:10
#47 0x7f5b575055d3 in mozilla::dom::Document::DispatchContentLoadedEvents() src/dom/base/Document.cpp:7457:3
#48 0x7f5b57577996 in applyImpl<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1148:12
#49 0x7f5b57577996 in apply<mozilla::dom::Document, void (mozilla::dom::Document::*)()> /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1154:12
#50 0x7f5b57577996 in mozilla::detail::RunnableMethodImpl<mozilla::dom::Document*, void (mozilla::dom::Document::*)(), true, (mozilla::RunnableKind)0>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:1201:13
#51 0x7f5b558cc4b2 in mozilla::SchedulerGroup::Runnable::Run() src/xpcom/threads/SchedulerGroup.cpp:146:20
#52 0x7f5b558d2a7f in mozilla::RunnableTask::Run() src/xpcom/threads/TaskController.cpp:472:16
#53 0x7f5b558d0ff0 in mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:760:26
#54 0x7f5b558cfdb4 in mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) src/xpcom/threads/TaskController.cpp:611:15
#55 0x7f5b558cff67 in mozilla::TaskController::ProcessPendingMTTask(bool) src/xpcom/threads/TaskController.cpp:395:36
#56 0x7f5b558d6896 in operator() src/xpcom/threads/TaskController.cpp:133:37
#57 0x7f5b558d6896 in mozilla::detail::RunnableFunction<mozilla::TaskController::InitializeInternal()::$_3>::Run() /builds/worker/workspace/obj-build/dist/include/nsThreadUtils.h:534:5
#58 0x7f5b558e7d87 in nsThread::ProcessNextEvent(bool, bool*) src/xpcom/threads/nsThread.cpp:1158:16
#59 0x7f5b558ee79a in NS_ProcessNextEvent(nsIThread*, bool) src/xpcom/threads/nsThreadUtils.cpp:548:10
#60 0x7f5b562172a6 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:87:21
#61 0x7f5b56182383 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:335:10
#62 0x7f5b5618229d in RunHandler src/ipc/chromium/src/base/message_loop.cc:328:3
#63 0x7f5b5618229d in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:310:3
#64 0x7f5b5a005788 in nsBaseAppShell::Run() src/widget/nsBaseAppShell.cpp:137:27
#65 0x7f5b5b8628e3 in XRE_RunAppShell() src/toolkit/xre/nsEmbedFunctions.cpp:901:20
#66 0x7f5b5621818c in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) src/ipc/glue/MessagePump.cpp:237:9
#67 0x7f5b56182383 in MessageLoop::RunInternal() src/ipc/chromium/src/base/message_loop.cc:335:10
#68 0x7f5b5618229d in RunHandler src/ipc/chromium/src/base/message_loop.cc:328:3
#69 0x7f5b5618229d in MessageLoop::Run() src/ipc/chromium/src/base/message_loop.cc:310:3
#70 0x7f5b5b8624b8 in XRE_InitChildProcess(int, char**, XREChildData const*) src/toolkit/xre/nsEmbedFunctions.cpp:733:34
#71 0x55f65029bfb6 in content_process_main src/browser/app/../../ipc/contentproc/plugin-container.cpp:57:28
#72 0x55f65029bfb6 in main src/browser/app/nsBrowserApp.cpp:309:18
#73 0x7f5b6c3960b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16
#74 0x55f650279d5c in _start (/home/worker/builds/m-c-20210314213752-fuzzing-debug/firefox-bin+0x14d5c)
Flags: in-testsuite?
Attached file prefs.js

Nika, could you take a look? It looks like you changed this code about a week ago in bug 1209947. Thanks!

Flags: needinfo?(nika)

A Pernosco session is available here: https://pernos.co/debug/K76pql1LT-hB1fSiMwN1-w/index.html

Keywords: sec-high
Regressed by: 1209947
Has Regression Range: --- → yes
Keywords: regression

Set release status flags based on info from the regressing bug 1209947

[Tracking Requested - why for this release]: possible sec regression

Assignee: nobody → nika
Status: NEW → ASSIGNED
Flags: needinfo?(nika)

Simplify initial about:blank detection in SetCurrentURI, r=smaug
https://hg.mozilla.org/integration/autoland/rev/0eba07f66addc47c884f5908cd526f3c0354d440
https://hg.mozilla.org/mozilla-central/rev/0eba07f66add

Please request uplift to beta.

Group: dom-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(nika)
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch

As part of a security bug pattern analysis, we are requesting your help with a high level analysis of this bug. It is our hope to develop static analysis (or potentially runtime/dynamic analysis) in the future to identify classes of bugs.

Please visit this google form to reply.

Flags: needinfo?(nika)
Whiteboard: [sec-survey]

Comment on attachment 9210366 [details]
Bug 1699003 - Simplify initial about:blank detection in SetCurrentURI,

Beta/Release Uplift Approval Request

  • User impact if declined: Potential CanRunScript violation in edge-cases
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Performs a fairly simple change to the OnLocationChange detection logic making it more clear and reducing the chance of a misfire.
  • String changes made/needed: None
Flags: needinfo?(nika)
Attachment #9210366 - Flags: approval-mozilla-beta?

Comment on attachment 9210366 [details]
Bug 1699003 - Simplify initial about:blank detection in SetCurrentURI,

Approved for 88.0b3.

Attachment #9210366 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify-

Bugmon Analysis
Verified bug as fixed on rev mozilla-central 20210714215010-7ec7dd0cc7ac.
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Status: RESOLVED → VERIFIED
Keywords: bugmon
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: