Tricking user into creating an executable by hijacking drag n drop of an image
Categories
(Core :: DOM: Copy & Paste and Drag & Drop, defect)
Tracking
()
People
(Reporter: qab, Assigned: enndeakin)
References
Details
(Keywords: reporter-external, sec-moderate, Whiteboard: [post-critsmash-triage][adv-main97+][adv-esr91.6+])
Attachments
(5 files)
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Comment hidden (off-topic) |
Updated•8 years ago
|
Reporter | ||
Comment 5•8 years ago
|
||
Reporter | ||
Comment 6•8 years ago
|
||
Assignee | ||
Comment 7•8 years ago
|
||
Comment 8•8 years ago
|
||
Assignee | ||
Comment 9•8 years ago
|
||
Updated•8 years ago
|
Updated•8 years ago
|
Reporter | ||
Comment 10•8 years ago
|
||
Reporter | ||
Comment 11•8 years ago
|
||
Comment hidden (off-topic) |
Updated•6 years ago
|
Updated•6 years ago
|
Comment 13•6 years ago
|
||
I think comment 11 is for Neil
Assignee | ||
Comment 14•4 years ago
|
||
Updated•4 years ago
|
Updated•3 years ago
|
![]() |
||
Comment 15•3 years ago
|
||
don't allow any internal types to be assigned to a DataTransfer, r=nika
https://hg.mozilla.org/integration/autoland/rev/a566c029f7a5af517126482475f022cb675dbd98
https://hg.mozilla.org/mozilla-central/rev/a566c029f7a5
Comment 16•3 years ago
|
||
I'm going to assume that all branches are affected.
Updated•3 years ago
|
Comment 17•3 years ago
|
||
- This patch broke drag & drop in the Sidebery extension, because some setData calls now throw: https://github.com/mbnuqw/sidebery/search?q=setData
- We could probably use the same internal type check for bug 1728425, so this is nice.
- I was wondering why we didn't rename
text/_moz_htmlcontext
ortext/_moz_htmlinfo
as well?
Assignee | ||
Comment 18•3 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #17)
- This patch broke drag & drop in the Sidebery extension, because some setData calls now throw: https://github.com/mbnuqw/sidebery/search?q=setData
- We could probably use the same internal type check for bug 1728425, so this is nice.
Seems like we could just add text/x-moz-text-internal to the ones that extensions are allowed to set.
On one hand, it may be useful for tab management extensions to be able to assign text/x-moz-text-internal so that they can emulate tab dragging.
On the other hand, the sidebery extension doesn't use 'text/x-moz-text-internal' for its intended purpose anyway. I'm not sure what it's author intended, but the use of 'text/x-moz-text-internal' is fairly useless there since the code also assigns 'text/plain' during the same drag. The internal type is intended to assign plain text to be used only internally by the same application, so setting the plain text type as well breaks this.
- I was wondering why we didn't rename
text/_moz_htmlcontext
ortext/_moz_htmlinfo
as well?
These types shouldn't have any security considerations if assigned -- they specify some contextual information for html data -- I avoided changing them in case of compatibility issues.
Comment 19•3 years ago
|
||
The patch landed in nightly and beta is affected.
:enndeakin, is this bug important enough to require an uplift?
If not please set status_beta
to wontfix
.
For more information, please visit auto_nag documentation.
Comment 20•3 years ago
|
||
Thanks for your response Neil. I think your explanation makes sense I actually opened a PR to remove the usage of text/x-moz-text-internal
.
Comment 21•3 years ago
|
||
Testing results:
-
test case 1: DnD-PoC.html
97.0a1: when the image is dragged to the desktop, it gets copied as a png image named "0PhK7.png"
96.0b7: when the image is dragged to the desktop, a "bad.bat" file is created
95.0.2: when the image is dragged to the desktop, a "bad.bat" file is created -
test case 2: Poc2
97.0a1: when the image is dragged to the desktop, nothing happens, but it may be invalid considering the image is missing from the test page
96.0b7: when the image is dragged to the desktop, nothing happens, but it may be invalid considering the image is missing from the test page
95.0.2: when the image is dragged to the desktop, nothing happens, but it may be invalid considering the image is missing from the test page -
test case 3: DnD-PoC.html
97.0a1: when dragging the "First" and "Second" links to the bookmarks bar, nothing happens
96.0b7: when dragging the "First" and "Second" links to the bookmarks bar, nothing happens
95.0.2: when dragging the "First" and "Second" links to the bookmarks bar, nothing happens
This was tested in Windows 10. but it will be tested in the other OS types once clear steps to reproduce/verify are provided.
Considering the confusing results, I assume that the second and third test cases attached are not working properly.
Can you provide us correct steps to verify this implementation? Clear actual and expected results of the test cases are not found here.
Thanks, Neil!
Updated•3 years ago
|
Assignee | ||
Comment 22•3 years ago
|
||
Testcase 1 is showing the changed behaviour. It should drop the image with the png filename of the image and not 'bad.bat'. An exception should appear on the console.
Testcase 2 isn't related to this bug, but I don't see any issues with it. Likely fixed by some other bug.
Testcase 3 was fixed by bug 1543694.
Comment 23•3 years ago
|
||
I have confirmed this implementation also on Ubuntu 20.04.3 LTS and Mac OS 11.6.2.
Furthermore, the exception is seen in the Web COnsole is:
Uncaught DOMException: The operation is insecure. attachment.cgi:5
ondragstart https://bug1317873.bmoattachments.org/attachment.cgi?id=8811122&t=5jADaxuCwTIPOvknM5hZbt:5
Closing as verified. Thanks!
Comment 24•3 years ago
|
||
Please nominate this for ESR approval when you get a chance.
Assignee | ||
Comment 25•3 years ago
|
||
Comment on attachment 9227390 [details]
Bug 1317873, don't allow any internal types to be assigned to a DataTransfer, r=nika
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: Provides extra protection from possible exploit when dragging and dropping a file to the desktop. An attacker could create an image that is saved with an exe extension.
- User impact if declined: No user noticeable change
- Fix Landed on Version: 97
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Not risky
Comment 26•3 years ago
|
||
Comment on attachment 9227390 [details]
Bug 1317873, don't allow any internal types to be assigned to a DataTransfer, r=nika
Approved for 91.6esr.
Comment 27•3 years ago
|
||
uplift |
Comment 28•3 years ago
|
||
Testing results of reproduction and fix verification:
-
Windows 10:
ESR v91.5.1esr - when the image is dragged to the desktop, a "bad.bat" file is created
ESR v91.6.0esr - when the image is dragged to the desktop, it gets copied as a png image named "0PhK7.png" -
Mac OS 11.6.2:
ESR v91.5.1esr - when the image is dragged to the desktop, NOTHING HAPPENS (bat.bat is not created)
ESR v91.6.0esr - when the image is dragged to the desktop, it gets copied as a png image named "0PhK7.png" -
Ubuntu 20.04.3 LTS:
ESR v91.5.1esr - when the image is dragged to the desktop, it gets copied as a png image named "0PhK7.png" (appears to not reproduce)
ESR v91.6.0esr - when the image is dragged to the desktop, it gets copied as a png image named "0PhK7.png" (as expected in a fixed build) -
ESR build is taken from here:
https://treeherder.mozilla.org/jobs?repo=mozilla-esr91&revision=d8affed56ce5cbbc47e05736d7ce714bffd1f968
Based on the previous information, I will set this bug as verified fixed in ESR v91.6.0esr.
Please NI me if more investigation is necessary considering the unexpected behavior in ESR v91.5.1esr (on Mac and Linux).
Updated•3 years ago
|
Comment 29•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•9 months ago
|
Description
•