Live data from Hacker News

I can see your local web servers

http.jameshfisher.com

151–160 of 198 posts

Re: I can see your local web servers

#151

Earlier quoted context omitted.

Yup, excited for the meeting. Haven't seen those guys in a while. Was expecting to learn some security techniques, instead got essentially port scanned :)

Whereas I'm learning that my network is fairly secure against this type of port scanning.

Of course, mine was too. I'm sure in part due to the diligent security team that will be stopping by my desk in the next few days!

Re: I can see your local web servers

#153
Here's the tl;dr

  app.use(cors());
defaults to Access-Control-Allow-Origin: *

If you know how CORS works, you already know that even if the resource is on localhost, it's open to any web page, including not on localhost. You won't find anything enlightening here.

If you don't know how CORS works but you're using the Express middleware for it anyway, read the documentation: https://expressjs.com/en/resources/middleware/cors.html#conf...

Re: I can see your local web servers

#154

When will software engineers finally understand that issues like these aren't problems with some random service you run on your computer, but with the (lack of) security model behind modern web browsing?

Modern web browsing provides for this with same-origin policy. Same-origin policy can be negated by the server if it sets an overly lax CORS directive. So this is something that's secure by default, but can be broken if the "random service you run on your computer" decides to break it. I don't think that's an issue with the browser's security model.

Same-origin policy is not a security model. It's a ridiculous quarter century old hack. If you pause to think about it, domain names are a horrible way to delineate security boundaries on the web.

Re: I can see your local web servers

#156

Also if you are a front end developer and are on an insecure WiFi (coworking space or public WiFi) make sure you only bind to localhost. Otherwise other people on the network can see your frontend code which you are probably compiling with sourcemaps, which will give the attacker almost the complete source code of your SPA.)

But frontend applications expose mangled javascript which can be reverse engineered anyway

Re: I can see your local web servers

#157
post #134
post #64

Earlier quoted context omitted.

If like me you saw the bright red text "If you see any results like localhost:3000 is available!" as meaning :3000 was actually available, it's just an example. The yellow box above seems to be where the results would actually be.

I must admit, it was exactly this. I read the text without using my brain properly. Please accept my sincere apologies.

I did exactly the same thing and spent too long running various things to find out what on Earth was using the port! Only reason I had a good guess at what it may have been.

Re: I can see your local web servers

#159

I only ever run my local dev server on port 80, and use a hosts file to assign custom (fake) domain names to each of the sites I want to run. I mentioned as much here a few years ago when I first came across this idea of assigning (and remembering) random unique port numbers to every one of your apps in development, and was surprised to hear that it's such a common practice. It seems sub-optimal for a lot of reasons,…

This is more or less what I do, except instead of 80, I use a port above 1024 because those don't require root privileges to bind to: https://www.w3.org/Daemon/User/Installation/PrivilegedPorts....

I'm sure the Container Culture Kids have their own overly-complicated thing, though.

Re: I can see your local web servers

#160

Earlier quoted context omitted.

> expose a UI with a local web server I'm not talking about UIs hosted on local web servers being able to send requests to themselves, I'm talking about UIs hosted on REMOTE web servers being able to send requests to local ones. It seems far worse than a random cross-origin request to me and for the life of me I can't imagine uses cases.

That's not really how the internet works. What is a local webserver? Running on your machine? Running on your LAN? Running on your corporate intranet? How should a browser differentiate between these things? What qualifies as a remote server? Did you know, some very large enterprise environments squat on public IP's for private intranet internally due to address space exhaustion (IPv4 anyway)? Just because something…

This makes no sense. I'm just talking about localhost, I don't care where the physical computer is. It makes no difference if you're an enterprise with software running on a private or public or whatever IP. Whatever the case, I still don't see why you should be able to use JS to access a localhost address.
Post reply on HN