News for hackers. Stuff that matters.
Re:Why Is This Website Port Scanning Me? by vbezhenar on Wednesday May 20, 2020 @05:44PM (#23252232)
In Kazakhstan we have e-government website. This website allows users to use crypto-tokens to access government services (every citizen can get a digital certificate representing his identity).

This website used to run Java applet. This applet was signed and it could access restricted APIs to access USB device. So website talked to applet and applet talked to USB device to sign data.

After major web browsers disabled Java applets, they implemented another approach. Now user must install a software which runs a web server on 127.0.0.1. This webserver listens on a specific port and uses web socket to communicate.

So government website now uses JavaScript to connect to 127.0.0.1:12345 using websocket. And then it uses that connection to interact with USB device.

So an ability for external website to connect to 127.0.0.1 actually is essential for this use-case.

My guess is that there are plenty of other websites which use local web server to interact with locally installed software. I know at least one another such a website: Blizzard website. It runs web server in its game launcher and website can communicate with it.

PS also they have to install custom trusted certificate because browser requires wss from https and there's no easy way to get a legitimate certificate for that kind of use.

Re:Why Is This Website Port Scanning Me? by geofft on Wednesday May 20, 2020 @06:45PM (#23252876)
Since these use cases already require having software installed on your machine, it seems fine and safer to use a browser extension with native messaging for this:

https://developer.chrome.com/extensions/nativeMessaging

https://wiki.mozilla.org/WebExtensions/Native_Messaging

That bypasses the entire certificate question and lets the website know it's communicating with exactly this app and not something happening to listen on the port (and vice versa, too).

... Or, depending on what you're doing, just use a real desktop app, perhaps with an embedded browser.

Re:Why Is This Website Port Scanning Me? by vbezhenar on Thursday May 21, 2020 @09:39AM (#23258160)
Yep, that might work. But that would require significantly more work to support all browsers and platforms. Currently it's just a Java application and it works independently of OS or browser.
Re:Why Is This Website Port Scanning Me? by justinclift on Wednesday May 20, 2020 @09:40PM (#23254035)
> So government website now uses JavaScript to connect to 127.0.0.1:12345 using websocket.

It sounds like random other websites (Ebay, etc) would be able to interact with people's USB devices this way too. Maybe without people knowing?

Re:Why Is This Website Port Scanning Me? by _nalply on Thursday May 21, 2020 @01:19AM (#23255058)
Yes, if this is programmed badly (missing security or a security hole).

The browser connecting to the government website accesses two servers: the original one and the second local one you install yourself on your system. The local server runs natively and therefore can access the USB device. Like all servers it should be programmed such that misuse by hackers is prevented.

Re:Why Is This Website Port Scanning Me? by Shorel on Tuesday May 26, 2020 @01:34PM (#23314029)
That's already a security hole.

The only thing missing is a rogue website abusing it.

There's no guarantee you will never connect to any rogue website that abuses this government mandated backdoor.

Re:Why Is This Website Port Scanning Me? by vbezhenar on Thursday May 21, 2020 @09:40AM (#23258181)
When JavaScript establishes websocket connection, it sends its origin URL (I don't remember exactly where, probably that's in Referer header). So local webserver can deny connections from unwanted websites.
Re:Why Is This Website Port Scanning Me? by ThePowerOfFuet on Wednesday May 20, 2020 @07:10PM (#23253089)
The app running on localhost using WSS is not why they want[ed?] you to install a custom CA certificate.

https://en.wikipedia.org/wiki/Kazakhstan_man-in-the-middle_a...

Re:Why Is This Website Port Scanning Me? by vbezhenar on Thursday May 21, 2020 @09:41AM (#23258198)
No, that's not true. They used different certificate to MITM connections.
Re:Why Is This Website Port Scanning Me? by closeparen on Monday May 25, 2020 @01:46PM (#23303114)
There's no need to roll your own hardware integration for crypto tokens. Browsers have been able to do PKCS#11 client certificates from smart cards for a long time, in case WebAuthN / U2F are too modern for you.