News for hackers. Stuff that matters.
Re:The Native File System API allows web apps to save direct... by cromwellian on Tuesday September 08, 2020 @11:31PM (#24416738)
This is just a variation on <input type=file> as far as read-access is concerned.

For write access, it certainly could be used to store malware on a user's system, but so can "Save As" or clicking a link with HTTP headers that triggers a download. Basically, the "Save As" dialog from browsers have the same issues.

It is not downloading malware that is the issue, it's executing it. So unless you can trick the user into navigating to an existing binary that is normally executing on the system, and have the rights to replace it, executing is not any different that triggering the user to put something in his ~/Download directory and asking him to paste a shell command.

The API doesn't not provide a way to mark something executable, and it should block you from obtaining write access to any file already marked executable just like many mobile OSs don't let you simultaneously mark a page in memory as writable and executable.

The last one looks like a flaw, I couldn't find anything in the spec that says "thou shalt not let the user open a file marked executable for write access", although it does suggest banning access to stuff like C:/Windows, /usr, /Applications, etc.

But what really bothers me is people making uninformed comments. Rather than knee jerk trigger anytime any browser API is changed without fully reading the spec and then actually pointing out any weaknesses, we get the same low signal commentaries.

So again, browsers already allow unaware users to be tricked with bog standard fileupload form elements and Save As dialogs. This just breaks a hardcoded high level UI into smaller reusable parts, and it actually adds more concerns over security than the original 1997 spec for file upload and save.

Re:The Native File System API allows web apps to save direct... by viraptor on Wednesday September 09, 2020 @04:01AM (#24418537)
> It is not downloading malware that is the issue, it's executing it.

That line is very thin. Local DLLs, application configs setting path to executables, even desktop.ini (https://threat.tevora.com/usb-drives-desktop-ini-and-ntlm-ha...) and that's before we get into NTFS alternative streams and other really out there ideas.

If you can choose which path you download to, the user has lost. Even if they never actively execute the file.

Same on *nix. If you can add something to bashrc, or drop a new file in desktop autostart, who cares about the executable bit.

And sometimes you can point out bad ideas without reading the spec. WebUSB was that kind of bad idea even before someone figured out exactly how they can read one time codes from security dongles that way. (https://www.yubico.com/support/security-advisories/ysa-2018-...)

Re:The Native File System API allows web apps to save direct... by armada651 on Tuesday September 08, 2020 @11:44PM (#24416844)
It's important not to forget about drive-by DLL injection when making the "execution is the problem" argument.

Lots of executables on Windows link to DLLs that are not protected by the "KnownDLLs" protection. This means that if you can save a malicious DLL next to that executable you can make a perfectly legitimate executable run malicious code.

I haven't read into the API yet to determine how it protects against this, but it's definitely more nuanced than the argument you're making.

Re:The Native File System API allows web apps to save direct... by cromwellian on Wednesday September 09, 2020 @01:28AM (#24417488)
Ugh, my Win32 security knowledge is non-existent, but this sounds horrible. Seems to me that nothing marked 'from web' and non-executable should be loadable into a memory segment which can be executed, and nothing in the system partition should be overridable like this. This sounds like a flaw in the OS design.

The real irony of the comments on HN that "it's dead on mobile because Apple won't support it", is iOS is one of the few operating systems where this kind of API is trust worth. I would not expect iOS to give Safari privileges to see any files other data files the Safari process itself created by user interaction, or something on say, a Permission-protected directory (e.g. Photos). Ditto for OSX.

If anything, the API really a selling point for OSX/iOS security architecture, in that it can be made safe.

Re:The Native File System API allows web apps to save direct... by elcritch on Wednesday September 09, 2020 @03:58AM (#24418508)
> Seems to me that nothing marked 'from web' and non-executable should be loadable into a memory segment which can be executed,

Welcome to modern macOS and Safari. It’s a good idea, but puts up a block to third part or open source software. For now you can right-click and override (who knows for how long before Apple wants 30% of the price of all your desktop software too). I’d be more okay with the Mac version if you could add custom chains of trust.

Re:The Native File System API allows web apps to save direct... by BrandoElFollito on Wednesday September 09, 2020 @08:41AM (#24420343)
> nothing marked 'from web' and non-executable should be loadable into a memory segment

How would you "mark something 'from web'"? This is a file after all.

There are ways to sign files (executable or not) but there is no 'from web' flag as far as I know.

Re:The Native File System API allows web apps to save direct... by vlovich123 on Wednesday September 09, 2020 @09:02AM (#24420531)
You would be incorrect.

File Quarantine on OSX:

> https://support.apple.com/en-us/HT201940

Alternate data stream on Windows:

> https://www.howtogeek.com/70012/what-causes-the-file-downloa...

I wouldn't be surprised if Linux had it but I haven't used desktop Linux in a long time so I don't know what to search for, but generally having browsers annotate their file streams isn't an uncommon thing to support for filesystems & browsers.

Re:The Native File System API allows web apps to save direct... by yjftsjthsd-h on Wednesday September 09, 2020 @10:33AM (#24421433)
A decent number of linux filesystems do support extended attributes, which is how I assume you'd do this (actually, looking at https://en.wikipedia.org/wiki/Extended_file_attributes a lot of OSs support xattrs), but I'm not aware of any browsers using them to mark downloads.
Re:The Native File System API allows web apps to save direct... by vlovich123 on Thursday September 10, 2020 @03:26PM (#24435649)
I'm not aware of any browsers that don't mark files downloaded from the web as such.
Re:The Native File System API allows web apps to save direct... by BrandoElFollito on Wednesday September 09, 2020 @09:35AM (#24420818)
OK thanks - so this is a NTFS feature, meaning that if the file is stored on an non-NTFS partition, or sent further that "flag" is cancelled.
Re:The Native File System API allows web apps to save direct... by fortran77 on Wednesday September 09, 2020 @08:53AM (#24420439)
Sure there is:

https://textslashplain.com/2016/04/04/downloads-and-the-mark...

Windows File System is very advanced and has metadata streams.

Re:The Native File System API allows web apps to save direct... by lultimouomo on Wednesday September 09, 2020 @08:53AM (#24420441)
> How would you "mark something 'from web'"? This is a file after all.

Files can have metadata, and most modern filesystems provide some kind of file attribute facility. On macOS browsers do exactly what described, setting a file attribute on downloaded files. The user will then be warned when trying to execute the file.

Re:The Native File System API allows web apps to save direct... by inetknght on Wednesday September 09, 2020 @01:20AM (#24417427)
> This means that if you can save a malicious DLL next to that executable you can make a perfectly legitimate executable run malicious code.

Some people install browsers onto a USB drive -- or even run a browser directly from their Downloads directory. Such people are easy targets for this type of thing.

Re:The Native File System API allows web apps to save direct... by cromwellian on Wednesday September 09, 2020 @01:30AM (#24417512)
If you look at the way most scammers work, it's even simpler than that. They simply phish people by sending them a link and telling them to run it for some reason (it'll fix their computer, it's a required security update, etc) or they tell them to install something like TeamViewer so they can help them eliminate security flaws, and call center scammers then pillage their box.

I'm amazed the the number of people still forwarding chain letters to me in Facebook, so who knows how many people fall for the "pass this Javascript into your browser console" trick.

Re:The Native File System API allows web apps to save direct... by im3w1l on Wednesday September 09, 2020 @04:03AM (#24418553)
Installers would be the most common I think.
Re:The Native File System API allows web apps to save direct... by saagarjha on Wednesday September 09, 2020 @02:11AM (#24417773)
Running a browser from the downloads directory is unlikely to work correctly on macOS.
Re:The Native File System API allows web apps to save direct... by imwillofficial on Wednesday September 09, 2020 @05:09AM (#24418957)
It’s funny you say this, because I did exactly this yesterday. I downloaded chromium and forgot I had not yet dragged it to my applications folder and I was running it for a few hours out of my downloads folder.
Re:The Native File System API allows web apps to save direct... by saagarjha on Wednesday September 09, 2020 @05:48AM (#24419231)
Google Chrome ships in a DMG, doesn’t it? This means that if it is running out if your downloads folder, it’s not subject to the things that would mess it up because you dragged it there.
Re:The Native File System API allows web apps to save direct... by merlinscholz on Wednesday September 09, 2020 @07:17AM (#24419754)
I think Chromium does get shipped as a normal executable, it's only Chrome which gets released as DMG.
Re:The Native File System API allows web apps to save direct... by cm2187 on Wednesday September 09, 2020 @03:04AM (#24418120)
The article says there is a possibility to grant access to a directory. For a non technical user who clicks “ok, whatever” on 200 cookies consent and newsletter nagging popups a day, there is a high probability they will click ok without reading it. This is absolutely not like the file input. Once you have access to a folder, you can write a decent cryptolocker.
Re:The Native File System API allows web apps to save direct... by cromwellian on Tuesday September 08, 2020 @11:34PM (#24416768)
BTW, for anyone who has children who are doing distance learning during COVID, the vast majority of school districts are using the Web, not native apps on desktop or iOS for the kids to do collaborative learning and submit work.

From what I've seen, they're basically creating APIs like this that set on top of GDrive, DropBox, and File Upload / Server-directed File-Save. So in essence, all this new API is mostly buying you is offline mode.

Re:The Native File System API allows web apps to save direct... by snvzz on Tuesday September 08, 2020 @11:47PM (#24416860)
>So in essence, all this new API is mostly buying you is offline mode.

There's been, for a long time, local storage APIs.

This is filesystem access, which is very different.

Re:The Native File System API allows web apps to save direct... by im3w1l on Wednesday September 09, 2020 @04:08AM (#24418582)
I think adding a virtual file system to the local storage API's might be fine. One which cannot be mounted easily by non-technical users but has a viewer which allows dragging files into and out of it.
Re:The Native File System API allows web apps to save direct... by lioeters on Wednesday September 09, 2020 @07:01AM (#24419666)
I vaguely recall something like that, a virtual file system using browser local storage. A search yields:

> BrowserFS is an in-browser file system that emulates the Node JS file system API and supports storing and retrieving files from various backends.

https://github.com/jvilk/BrowserFS

It supports storage backends such as: in memory, LocalStorage, IndexDB, HTTP, or the FileSystem API.

Re:The Native File System API allows web apps to save direct... by chromedev on Wednesday September 09, 2020 @01:43AM (#24417596)
Which has policies that can be enabled to block it if necessary
Re:The Native File System API allows web apps to save direct... by snvzz on Wednesday September 09, 2020 @02:22AM (#24417848)
Users click "accept" to make things work.

Filesystem access is going to have nefarious consequences.

Re:The Native File System API allows web apps to save direct... by chromedev on Wednesday September 09, 2020 @04:43AM (#24418804)
That's not how policies work. Schools, organizations and even home users can enable policies to block this feature altogether as well as many others:

https://cloud.google.com/docs/chrome-enterprise/policies/

Re:The Native File System API allows web apps to save direct... by emteycz on Wednesday September 09, 2020 @09:36AM (#24420828)
I'd like to see that ordinary user that is configuring API usage policies on their home network
Re:The Native File System API allows web apps to save direct... by dwild on Wednesday September 09, 2020 @11:19AM (#24421977)
I just went to the documentation there: https://wicg.github.io/native-file-system/

I get that from your comment you agree that this is enough to mitigate the risk they themselves bring up:

>Another risk factor is that of ransomware attacks. The limitations described above regarding blocking access to certain sensitive directories helps limit the damage such an attack can do. Additionally user agents can grant write access to files at whatever granularity they deem appropriate.