Windows Snipping Tool is vulnerable to Acropalypse too
twitter.com
twitter.com
But why is this even happening? The standard procedure to overwrite a file is to save to a temporary file first so an error that occurs during the write won't damage the existing file. Are they really doing an in-place write and how does that affect the shadow copy if you wanted to restore the previous version of the file?
Being a true "full stack" engineer is a superpower when it comes to performance optimisation, or vulnerability research.
Knowing how code works on systems IS a super power.
And every abstraction leaks. Living on a given level without at least an accurate mental model of everything bellow it limits your ability as a developer. Sure you can just do scripting for a web dev team your whole career. If that's what you want...
Your choices matter to you not to society.
… which on the other hand has the annoying side effect of wrecking hard links.
Unless of course you wanted them to remain the same…
(Of course the thing that'd solve my actual root problem would be proper OS and file system level support for tagging, but until then it seems that there are only imperfect solutions, each with its own set of drawbacks.
I.e. third party software is not well integrated with the file explorer and the file open/save dialogues etc., and now I'm dependent on that software lest I lose all my carefully tagged data, whereas hard or symbolic link-based solutions are clunky to use and vulnerable to either atomic saves or file renaming etc.)
Thus the reason why you could end up with old bits of a Word document sticking around inside the .doc is the same as to why your FS has bits of deleted files: the space has been marked as free, and nothing else overwrote it yet.
But none of this applies to images, so the explanation here ought to be different.
Probably the "dump of Word's working memory" part emanates from Word for DOS, which predates COM by the order of a decade.
see https://web.archive.org/web/20160308183811/http://1017.songt...
The COM structured storage Office file format came from OLE2 (object linking and embedding - one of the mid-90s must-have features)
I don’t think writing to a separate file is standard procedure at all. Way more apps don’t do that than do from my anecdotal memories.
Personally I'd probably always save to a new file even if the amount of work potentially lost is negligible (as in a snipping tool). The cost of doing so is extremely small in development so that if you ever save one customer's file, you probably saved more time than it cost you to implement transactional file writing. It's a few extra lines, if you opt out of the more complex scenarios (E.g. you can't make atomic renames to move if the target is a network share).
It originally referred to a specific vulnerability in the Markup app found on Google Pixel devices (CVE-2023-21036), but apparently now includes other unrelated apps.
Source: It was me who came up with the name :)
Kudos on the name by the way, I love a good tight pun name for a vulnerability.
Wow, it's almost textbook
Is the periodic reencoding of the huffman tree part of DEFLATE or in the PNG are they just using a sequence of separate DEFLATE structures appended together that each have their own huffman tree? If it's the former, you might be able to recover part of a ZIP archive entry that was reduced in size and written over the original version.
I'll have a windows-compatible PoC up at some point, might wait a little bit just to mitigate the 0day-ness heh
Edit: tried this with snip and sketch. Also tried it with snipping tool. Fwiw, the latter results in a smaller file size.
> Fwiw, the latter results in a smaller file size.
Implying the former does not result in smaller file size? If so, you've reproduced the vuln.
The animations are terrible and I hate that I have to click on a notification to actually open the window.
Win10 snipping tool: From my cold, dead hands.
Exploiting aCropalypse: Recovering truncated PNGs - https://news.ycombinator.com/item?id=35208721 - March 2023 (71 comments)
Acropalypse: a vulnerability in Google's screenshot editing tool - https://news.ycombinator.com/item?id=35207787 - March 2023 (44 comments)
pngcheck good.png
OK: good.png (467x389, 32-bit RGB+alpha, non-interlaced, 88.2%).
Compared to a vulnerable image: pngcheck bad.png
bad.png additional data after IEND chunk
ERROR: bad.png
macOS Preview, Quick Look, and CleanShot X are safe.[1] https://www.libpng.org/pub/png/apps/pngcheck.html, available in Homebrew
I tend to use the rectangular option in the snipping tool as a way to be certain that I won't forget to crop important info. Both of these make me think I need to check my process and see if it is relevant.
Wait, don't we all do this? :looks around horrified:
Edit: I guess I don't usially save before cropping a screenshot. But it's not something I really thought about before either.
Man if I ran Windows 11 to think I might be the one who stumbled on this 0-day first....
Also, both discord and imgur trimmed an image I uploaded to just the image data. Slack did not, however. I certainly wouldn't want to rely on that behavior, though.
Most people are not super techie computer users.
Still... you don't need MOST people. You need ONE, with a blog or a youtube account. And it took how long?
https://www.extremetech.com/computing/342819-windows-11-gain...
[0] https://issuetracker.google.com/issues/180526528
[1] https://stackoverflow.com/questions/35842374/how-can-i-overw...
New iterations of classic Snipping Tool require more clicks and the implementation is worse too.
Their image tool that we were using for video snippet is a lot worse. Hell right click context menu requires more work.
Don't get me started on minimum window sizes for some default apps.
I mean it's bad, but... who does that?
EDIT: It also happens if you take a completely different screenshot and just save over (overwrite) another (bigger) image. That's worse, but still not that common IMHO.
Programmers do it all day ... with text files.
Would you say the same thing if when you deleted some code it would actually still be there at the end of the file, after two pages of spaces?
When you delete something and save it in a "final" format (like a PNG), you expect nothing which was deleted to be there.
1. Take screenshot
2. Open screenshot
3. Edit screenshot
4. Save screenshot
I don't think that "Save As..." the common case.
(I'm the PNG spec chair and also the person who discovered Snipping Tool is vulnerable.)
> The PNG decoder has to determine whether a syntax error is fatal (unrecoverable) or not, depending on its requirements and the situation. For example, most decoders can ignore an invalid IEND
It doesn't explicitly mention what decoders should do on encountering data after IEND, but The general philosophy for decoders seems to be that errors should be handled gracefully where possible, even if the file is technically malformed (which is maybe something that could be clarified or expanded upon?)
For others, Retr0id has been helping with the PNG spec. A third edition is in the works.
Why? Because users have stuff to do. They don't know about and don't care for errors.
The most prominent example are web browsers. Browsers are supposed to crash when fed invalid HTML, and this was even mandated when XHTML was trying to replace HTML. Users fucking hated it, and XHTML crashed and burned and HTML with its error-safe handling has stayed to this day.
Or alternatively press the notification -> draw something -> control+c -> close then paste.
I rarely save as file, no need, but I guess I've sometimes do it so I need to be careful.
You should notice that the file size didn't actually get any smaller after you cropped it. The full-size image file is not truncated before the cropped version is written. The left-behind data can be recovered.
The bit about recovering LZ77 stream without the prefix sounds very useful as a data recovery tool.
i will let someone test the same technique on those cases but empirically i've had screenshots as little as a couple KB this way.
That two different tools fail in the same, "surface level invisible" but mighty convenient, and "Whoopsie, file operations are hard!" way... raises some interesting questions.
Mostly, "What else of this nature is present in all our modern operating systems?" Because this sort of failure sure looks an awful lot like the "Underhanded C" contest from 2008: http://www.underhanded-c.org/_page_id_17.html Redact an image, while leaking a lot of information in the process to someone who "knows the trick."
> This is an excellent example of the contest’s philosophy: make the code extremely simple, innocent, obvious, and wrong.
On Windows 11, Snipping Tool is vulnerable. (And it doesn't suggest you get Snip & Sketch.)
I can reproduce it with Snip & Sketch on Windows 10 using Save As (Ctrl+S).
Also on linux you'd quickly notice something was wrong with the file sizes.
Plenty of people send images around after cropping out sensitive parts.
Originally acropalypse was a specific library, but the bug itself is "saving data over an existing file does not replace the existing file".
> only if you do the strange "overwrite existing file" thing the OP did
Overwriting an existing file is literally the most common case: it's what happens when you say "save" instead of "save as...".
I don't understand all the brouhaha.
This data is not made available to the user to uncrop the data at a later time, so it provides no benefit to the user, just risk of privacy violations.
Because it's a zero day!
You can't imagine someone cropping out banking information, identifying information in anonymous contexts, confidential information?
Which you should take as a "maybe I have misunderstood the issue".
This is not an edit list, or the ability to undo operations. The problem is you have an existing file ("foo.png" or whatever):
oooooooooo
then you make a new file with this data in memory: nnnnn
This could be something like you opened the original foo.png file and made a change that results in the file shrinking, or it could be some completely unrelated data. Now you save this as foo.png and the editing program assumes opening a file for writing will erase the old data and writes out the new data. The end result is you have this file: nnnnnooooo
e.g. the tail of the old file is still present in the file data. It turns out it's possible to recover the pixel data from those tail bytes, in spite of losing the compression state.Now the assumption that writing over an existing file will truncate/erase the original file is reasonable. That's the default behavior of most file IO APIs. I don't know what the windows app is doing, but the original android bug was an API that takes a mode string copied from posix's fopen, in which "w" means "open for writing, and erase any existing file", but then later on made an undocumented change that made opening a file with "w" no longer erase existing files.