News for hackers. Stuff that matters.
Re:Man who thought opening a TXT file is fine thought wrong by crazygringo on Friday April 02, 2021 @10:35PM (#26677994)
Oh, man. The idea that TextEdit automatically parsed .txt files as HTML if they started with a certain file signature is problematic...

...but the fact that file:// schemes can access remote files by appending /net/ followed by a domain name is pretty shocking.

I mean, the entire purpose of "file://" would seem to be to provide access to local/mounted files and only those.

The fact that a Mac engineer thought it would be a great "feature" to allow file:// to access the entire internet is... kinda terrifying. Did that get patched, or was it only TextEdit?

Re:Man who thought opening a TXT file is fine thought wrong by bawolff on Friday April 02, 2021 @11:48PM (#26678289)
> ...but the fact that file:// schemes can access remote files by appending /net/ followed by a domain name is pretty shocking.

Not that shocking. Windows has had that with SMB networking for ages file://SMBSERVERNAME/path/file . Linux somewhat supports /dev/tcp/HOSTNAME/PORT (technically that's application level in bash so not everywhere), and im sure there's daemons you could run to automount things on the fly.

Re:Man who thought opening a TXT file is fine thought wrong by tetha on Saturday April 03, 2021 @05:01AM (#26679411)
> Linux somewhat supports /dev/tcp/HOSTNAME/PORT (technically that's application level in bash so not everywhere), and im sure there's daemons you could run to automount things on the fly.

Do note that this has been disabled in the major distributions at compile time for pretty much ever. The debian bug to build bash with that feature by default is ~20 years old (and was closed as wontdo).

Re:Man who thought opening a TXT file is fine thought wrong by kevinoid on Saturday April 03, 2021 @08:30AM (#26680523)
Although it was disabled in Debian bash 2.04-5 on 2000-06-05, it was re-enabled in bash 4.0-5 on 2009-09-13 and is currently enabled. See https://metadata.ftp-master.debian.org/changelogs/main/b/bas...
Re:Man who thought opening a TXT file is fine thought wrong by exikyut on Saturday April 03, 2021 @07:18AM (#26680068)
On two different Debian 10 boxes bash seems to have it enabled:

  Terminal 1
  $ echo hi > /dev/tcp/127.0.0.1/9999

  Terminal 2
  $ nc -vvvlp 9999
  Listening on [0.0.0.0] (family 2, port 9999)
  Connection from 127.0.0.1 57540 received!
  hi
  $
Re:Man who thought opening a TXT file is fine thought wrong by amenod on Saturday April 03, 2021 @09:28AM (#26680867)
For anyone wondering, it is enabled by default on Ubuntu too. I wonder what made someone think that this was a good idea?
Re:Man who thought opening a TXT file is fine thought wrong by rijoja on Saturday April 03, 2021 @11:05AM (#26681603)
If you follow the everything is a file philosophy it seems quite natural does it not?
Re:Man who thought opening a TXT file is fine thought wrong by soulofmischief on Saturday April 03, 2021 @12:24PM (#26682279)
Except permissions aren't granular enough / are too confusing, it's a giant footgun with the current Linux architecture, which doesn't have all the nice things Plan9 does
Re:Man who thought opening a TXT file is fine thought wrong by rijoja on Wednesday April 07, 2021 @01:39PM (#26728148)
I didn't say that the everything is a file philosophy is necessarily correct and well implemented on Linux. Merely that if you where to continue along this direction it would seem like a logical next step. I don't think I would use this for anything but for shell scripts at best. However especially if you are a plan 9 fanatic then it would seem like quite a good idea which is what the original question was.
Re:Man who thought opening a TXT file is fine thought wrong by bawolff on Saturday April 03, 2021 @05:06PM (#26684736)
I mean, unless you're host is extremely locked down you'll probably also have telnet,netcat, etc installed, so no great difference.
Re:Man who thought opening a TXT file is fine thought wrong by nolok on Saturday April 03, 2021 @05:46PM (#26685023)
I'm no specialist but I'm inclined to disagree, for me it's the difference between the ability to run an arbitrary binary and the ability to read/write an arbitrary filepath
Re:Man who thought opening a TXT file is fine thought wrong by capitainenemo on Monday April 05, 2021 @07:53AM (#26697842)
They are imaginary paths in the bash executable. They aren't usable outside it. Thus the netcat analogy.
Re:Man who thought opening a TXT file is fine thought wrong by LinuxBender on Monday April 05, 2021 @10:09AM (#26699150)
Anything you can do in telnet or netcat can also be done in python, perl, ruby. One of those is likely installed, most probably python.
Re:Man who thought opening a TXT file is fine thought wrong by rijoja on Sunday April 11, 2021 @06:22AM (#26769184)
And if you think about if all applications where using files for communication blocking one program from the internet would be as simple as a chmod.
Re:Man who thought opening a TXT file is fine thought wrong by crazygringo on Saturday April 03, 2021 @12:52PM (#26682557)
SMB is more understandable though, since you have more trust for things on your local network, and an attacker usually won't have control over those resources. And it's a fairly common and reasonable expectation in a business environment that network drives appear as part of the filesystem.

Whereas a domain name over the open internet is an entirely different story.

Re:Man who thought opening a TXT file is fine thought wrong by bawolff on Saturday April 03, 2021 @05:08PM (#26684753)
Its been a while since i've done windows stuff, but i thought you could use IP addresses in addition to netbios names for smb - \\1.2.3.4\share\file
Re:Man who thought opening a TXT file is fine thought wrong by ComodoHacker on Sunday April 04, 2021 @01:30AM (#26687125)
You can use \\domain.name\share\ as well.
Re:Man who thought opening a TXT file is fine thought wrong by ngcc_hk on Saturday April 03, 2021 @04:33AM (#26679276)
Actually if I am not mistaken it is after they want to fight the browser war they break the barrier between the file system and internet system. It is not in the early version of windows or IE. the integration is one of the major mistakes Microsoft made. And surprise apple fall for it as well.

Can’t trust these two or ,,, who can we trust for network security.

Re:Man who thought opening a TXT file is fine thought wrong by StavrosK on Saturday April 03, 2021 @10:07AM (#26681159)
Most likely nobody decided to have file:// access the network. Most likely, someone decided to make file:// the scheme for accessing files, and someone else decided to mount the network as a file.
Re:Man who thought opening a TXT file is fine thought wrong by alfiedotwtf on Saturday April 03, 2021 @06:28PM (#26685308)
My memory is hazy, but I think this was a “feature” of Plan9
Re:Man who thought opening a TXT file is fine thought wrong by comex on Saturday April 03, 2021 @01:52AM (#26678695)
It's not specific to the file:// URI scheme; /net is an actual filesystem path that works with anything that accesses paths. Or used to work, anyway; it was recently changed to be disabled by default.
Re:Man who thought opening a TXT file is fine thought wrong by tmp538394722 on Friday April 02, 2021 @11:32PM (#26678219)
“Everything’s a file!”
Re:Man who thought opening a TXT file is fine thought wrong by DyslexicAtheist on Saturday April 03, 2021 @05:29AM (#26679532)
> In Unix everything is a file. Files are files, folders are files, disks are files, your keyboard is a file, your mouth is a file, the air is a file, you can't breathe, your file lungs fill with files and you try to scream but only files come out oh god Dennis how could you do this

-- https://twitter.com/TartanLlama/status/1375045731644538882

Re:Man who thought opening a TXT file is fine thought wrong by rcrisan on Saturday April 03, 2021 @02:33AM (#26678810)
perhaps this is the worst possible abstraction to be protected by a security framework.
Re:Man who thought opening a TXT file is fine thought wrong by boomlinde on Saturday April 03, 2021 @05:50AM (#26679638)
How is that? Per-process namespaces in Plan 9 seem like a good idea for isolation. "Everything is a file," but what is and isn't accessible can be managed on a per-process level.

In POSIX we only generally get a user/group level of granularity which seems to practically mean that only daemons are completely isolated.

Re:Man who thought opening a TXT file is fine thought wrong by hamstergene on Sunday April 04, 2021 @12:39PM (#26690890)
Per process won’t be good enough in a different app that does legitimately need `/net`, just not when displaying file:/// links inside HTML pages.
Re:Man who thought opening a TXT file is fine thought wrong by boomlinde on Monday April 05, 2021 @01:46PM (#26702109)
I disagree. Use a second process that has a limited namespace where you've mounted only the local files you want an HTML document to be able to refer to and an IPC socket marked for exclusive use. The first process resolves file links and reads file contents via IPC to the second process.
Re:Man who thought opening a TXT file is fine thought wrong by aenario on Saturday April 03, 2021 @05:32AM (#26679544)
I can see a way this would be useful to use the same abstraction to limit app/user web access to a single domain.

For instance the dropbox binary can only access "/home/dropbox" and "/net/dropbox.com" if this was more well-known/used.

Re:Man who thought opening a TXT file is fine thought wrong by bestorworse on Sunday April 04, 2021 @05:45PM (#26693110)
This can be done with a proper capability system.
Re:Man who thought opening a TXT file is fine thought wrong by extropy on Saturday April 03, 2021 @03:47AM (#26679076)
IMO not so much. Just assume all files are malicious unless accompanied by metadata saying otherwise. That is pretty much the status quo already.

Except we have some grandfathered file types that are implicitly trusted.

Re:Man who thought opening a TXT file is fine thought wrong by Jabbles on Saturday April 03, 2021 @04:03AM (#26679150)
In the article, the remote file's contents were not malicious, but merely trying to access it was. That would require a very different security posture to "assume all files are malicious".
Re:Man who thought opening a TXT file is fine thought wrong by DyslexicAtheist on Saturday April 03, 2021 @05:32AM (#26679551)
> the remote file's contents were not malicious

until ... one day ... they are!

Re:Man who thought opening a TXT file is fine thought wrong by boomlinde on Saturday April 03, 2021 @05:52AM (#26679650)
The remote file is only one of two files in the story.
Re:Man who thought opening a TXT file is fine thought wrong by Lucasoato on Saturday April 03, 2021 @04:03AM (#26679154)
And what about malicious metadata?
Re:Man who thought opening a TXT file is fine thought wrong by ryandrake on Saturday April 03, 2021 @12:10PM (#26682152)
I don't think "everything is a file" is necessarily bad. What's worse is "every application I run has access to every resource that the OS gives my user access to".

Would be nice if the operating system could set up a fresh, temporary "user" for each application installed, and instead run the application as that user, who starts out with no access to computing resources. Maybe some existing systems already sandbox apps into their own unprivileged users, I don't know, but it would probably be very secure.

Re:Man who thought opening a TXT file is fine thought wrong by Blikkentrekker on Saturday April 03, 2021 @03:15PM (#26683851)
Modern operating systems can; there is quite granular control.

But often when such sandboxes are attempted, it turns out that it often became more complex than originally thought, and applications need many resources which were not originally considered, so they are given those resources, and very often those resources can be used again to construct more resources or otherwise to some measure escape the sandbox.

Re:Man who thought opening a TXT file is fine thought wrong by SamPatt on Monday April 05, 2021 @01:08AM (#26695549)
I believe this is how Qubes OS is supposed to operate.
Re:Man who thought opening a TXT file is fine thought wrong by eeZah7Ux on Saturday April 03, 2021 @09:18AM (#26680810)
On the contrary, it's very good design.
Re:Man who thought opening a TXT file is fine thought wrong by rualca on Saturday April 03, 2021 @10:49AM (#26681483)
> perhaps this is the worst possible abstraction to be protected by a security framework.

I honestly don't understand how anyone with at least a basic understanding of how OSes are designed and operated could ever arrive at that conclusion. The layers of wrong assumptions required to support that assertion are in the level of "not even wrong" confusions.

Re:Man who thought opening a TXT file is fine thought wrong by rualca on Saturday April 03, 2021 @10:53AM (#26681509)
> “Everything’s a file!”

I fail to see how HTTP and REST's "everything is a resource" paradigm is significantly different than UNIX's "everything is a file" paradigm, and I'm yet to see anyone claim that the freedom and power to open any HTML document (OMG a file!) made available through the internet is a mistake or a bad design decision.

Re:Man who thought opening a TXT file is fine thought wrong by wbl on Saturday April 03, 2021 @04:32PM (#26684461)
Several ways. In Unix files are streams of bytes. In HTTP resources are complex entities with MIME types, multiple representations, encodings, etc. HTTP URL structure supports parameters and there is a method for providing data and obtaining a result back, a sort of RPC.

On the other side Unix has users and permissions, HTTP does not and you have to build your own.

Re:Man who thought opening a TXT file is fine thought wrong by SquibblesRedux on Friday April 02, 2021 @11:05PM (#26678129)
Looking in /etc/auto_master, which is the configuration for Autofs, the /net mount point is commented out by default. I do not know when (or if) it was ever turned on by default.
Re:Man who thought opening a TXT file is fine thought wrong by tmp538394722 on Saturday April 03, 2021 @12:08AM (#26678366)
Whether or not a default configuration is vulnerable is a pretty typical component of accessing a vulnerability’s severity.

Unfortunate that the author didn’t mention this.

Obviously this doesn’t excuse the bug, but it’s important to contextualize if we hope to compare relative impact and have frank discussions.

Re:Man who thought opening a TXT file is fine thought wrong by comex on Saturday April 03, 2021 @01:47AM (#26678682)
The default configuration was, in fact, vulnerable at the time. Having it be commented out by default is new.
Re:Man who thought opening a TXT file is fine thought wrong by saagarjha on Saturday April 03, 2021 @06:55AM (#26679951)
Re:Man who thought opening a TXT file is fine thought wrong by icedchai on Saturday April 03, 2021 @12:07PM (#26682127)
I'm stilling running Mojave (10.14.x) and it is uncommented. The file dates to 2014 so I suspect it was set up with the original OS that came with this machine.
Re:Man who thought opening a TXT file is fine thought wrong by azinman2 on Friday April 02, 2021 @11:05PM (#26678132)
/net is really meant for things like nfs.
Re:Man who thought opening a TXT file is fine thought wrong by jjtheblunt on Friday April 02, 2021 @10:39PM (#26678005)
I think it carries over from NeXTstep, iirc.
Re:Man who thought opening a TXT file is fine thought wrong by ethbr0 on Friday April 02, 2021 @11:02PM (#26678112)
It feels like a choice when "net" meant "my campus network", not "the internet."

Because why would you be connected to the internet all the time? And how could you even afford those long distance calls?

Re:Man who thought opening a TXT file is fine thought wrong by 1MachineElf on Saturday April 03, 2021 @12:34AM (#26678464)
Because why would you be connected to the internet all the time? And how could you even afford those long distance calls?

That one East German guy in Cliff Stoll's The Cuckoo's Egg found a creative answer for both of those.

Re:Man who thought opening a TXT file is fine thought wrong by neycoda on Saturday April 03, 2021 @04:04PM (#26684272)
A file can be accessed locally, on a private network, or over the internet. The fact that /net/ exists is redundant to http file download... so there's an argument there, but to access a local network file through http requires a webserver which may not be desired. So, having file /net/ solves that problem but of course could work the same way on an internet network so... we're kind of screwed really.
Re:Man who thought opening a TXT file is fine thought wrong by tim44 on Saturday April 03, 2021 @05:37AM (#26679574)
holy batman
Re:Man who thought opening a TXT file is fine thought wrong by rualca on Saturday April 03, 2021 @10:57AM (#26681544)
> I mean, the entire purpose of "file://" would seem to be to provide access to local/mounted files and only those.

This is the only story here. Everything else sounds like clueless hyperboles.

Re:Man who thought opening a TXT file is fine thought wrong by benatkin on Saturday April 03, 2021 @01:15AM (#26678588)
The extension is meaningless outside of Windows...
Re:Man who thought opening a TXT file is fine thought wrong by tsimionescu on Saturday April 03, 2021 @03:15AM (#26678951)
File extensions are routinely used by all sorts of software, at least as hints if nothing else. For example, gcc will handle files named .c differently from files named .cpp, and will not even work with static libraries unless they are named .a.
Re:Man who thought opening a TXT file is fine thought wrong by Thorrez on Saturday April 03, 2021 @02:04AM (#26678722)
It doesn't sound like that from the article:

>the default text reader on OSX, TextEdit is used to open files with TXT extension by default.

>Gatekeeper doesn’t quarantine TXT files

Re:Man who thought opening a TXT file is fine thought wrong by andylynch on Saturday April 03, 2021 @10:32AM (#26681371)
Far from it. Even Mac OS stopped using type and creator codes in favour of file extensions, 11 years ago (with snow leopard).