Firefox · DOM
CVE-2025-8042
Sandbox Escape in DOM
Overview
Medium
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Changed Functions
| Function | Change | Notes |
|---|---|---|
ifmobile/android/components/geckoview/GeckoViewStreamListener.cpp |
modified | |
ifuriloader/exthandler/nsExternalHelperAppService.cpp |
modified |
Files Changed
dom/security/nsContentSecurityUtils.cppdom/security/nsContentSecurityUtils.hmobile/android/components/geckoview/GeckoViewStreamListener.cppuriloader/exthandler/nsExternalHelperAppService.cpp
Patch
diff --git a/dom/security/nsContentSecurityUtils.cpp b/dom/security/nsContentSecurityUtils.cpp
index 528beff667f..6e04c8b21f1 100644
--- a/dom/security/nsContentSecurityUtils.cpp
+++ b/dom/security/nsContentSecurityUtils.cpp
@@ -2204,8 +2204,7 @@ void nsContentSecurityUtils::LogMessageToConsole(nsIHttpChannel* aChannel,
}
/* static */
-long nsContentSecurityUtils::ClassifyDownload(
- nsIChannel* aChannel, const nsAutoCString& aMimeTypeGuess) {
+long nsContentSecurityUtils::ClassifyDownload(nsIChannel* aChannel) {
MOZ_ASSERT(aChannel, "IsDownloadAllowed without channel?");
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
diff --git a/dom/security/nsContentSecurityUtils.h b/dom/security/nsContentSecurityUtils.h
index 73102441f58..324ec302c7d 100644
--- a/dom/security/nsContentSecurityUtils.h
+++ b/dom/security/nsContentSecurityUtils.h
@@ -74,8 +74,7 @@ class nsContentSecurityUtils {
const mozilla::dom::Element& aElement);
// Helper function to Check if a Download is allowed;
- static long ClassifyDownload(nsIChannel* aChannel,
- const nsAutoCString& aMimeTypeGuess);
+ static long ClassifyDownload(nsIChannel* aChannel);
// Public only for testing
static FilenameTypeAndDetails FilenameToFilenameType(
diff --git a/mobile/android/components/geckoview/GeckoViewStreamListener.cpp b/mobile/android/components/geckoview/GeckoViewStreamListener.cpp
index 71b9fadeb50..387e5ce2eb2 100644
--- a/mobile/android/components/geckoview/GeckoViewStreamListener.cpp
+++ b/mobile/android/components/geckoview/GeckoViewStreamListener.cpp
@@ -16,6 +16,8 @@
#include "nsIWebProgressListener.h"
#include "nsIX509Cert.h"
#include "nsPrintfCString.h"
+#include "nsContentSecurityUtils.h"
+#include "nsITransfer.h"
#include "nsNetUtil.h"
@@ -85,6 +87,16 @@ GeckoViewStreamListener::OnStartRequest(nsIRequest* aRequest) {
return NS_OK;
}
+ nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
+ if (channel) {
+ int32_t classification = nsContentSecurityUtils::ClassifyDownload(channel);
+ if (classification == nsITransfer::DOWNLOAD_FORBIDDEN) {
+ channel->Cancel(NS_ERROR_ABORT);
+ CompleteWithError(NS_ERROR_ABORT, channel);
+ return NS_OK;
+ }
+ }
+
// We're expecting data later via OnDataAvailable, so create the stream now.
InitializeStreamSupport(aRequest);
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
index cd4d745890a..5bd60b585b5 100644
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -1621,8 +1621,7 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest* request) {
return NS_OK;
}
- mDownloadClassification =
- nsContentSecurityUtils::ClassifyDownload(aChannel, MIMEType);
+ mDownloadClassification = nsContentSecurityUtils::ClassifyDownload(aChannel);
if (mDownloadClassification == nsITransfer::DOWNLOAD_FORBIDDEN) {
// If the download is rated as forbidden,
Loading diff…
References
On This Page