Description
Details
This vulnerability was somewhat known within the GMod community for quite some time, I just wanted to bring more awareness.
Allowing clientside code to access private networks could possibly allow an attacker to gain access to clients' network devices, such as routers and modems. Furthermore, these devices frequently contain default password, and have outdated firmware.
The issue is especially relevant with existing addons such as: mediaplayers, custom sprays, starfall, and pac; where any user on a server could make http requests on any other users.
I'd suggest blocking requests for following subnets: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Other libraries and functions should also be taken into account.
Somewhat relevant effects of different attack, the vulnerabilities section specifically
Activity
thegrb93 commentedon Dec 17, 2018
What if I'm hosting a HTTP server on my LAN network and want garrysmod to be able to access it?
h3xcat commentedon Dec 17, 2018
I can't really think of any reasons why you'd want to connect to HTTP server on a private network. For developing an addon, you could just host it on a local computer. Otherwise, you could port forward the HTTP server, and use your public IP address.
thegrb93 commentedon Dec 17, 2018
I was considering hosting a neural network for some weird projects. Not a big fan of LAN limiting idea. Considering any html webpage can do it too, I don't see why gmod has to be neutered for the sake of outdated crap.
h3xcat commentedon Dec 17, 2018
I don't believe any web page could do it, definitely not public ones, usually browsers comes with CSP which prevents such attacks. Otherwise I'd be really concerned about browsing the internet, especially when consumer grade routers are known for their bad security.
Also, GMod users that do such experiments are very few, compared to the whole GMod community. I don't believe everyone should risk getting compromised for very few use cases used by few users.
The whole idea I like about Garry's Mod is that I can trust the game enough for it to run other people content without getting my network or computer compromised. Usually other exploits such executing binaries are patched within days, not sure why this is not considered a high security risk.
neico commentedon Dec 17, 2018
easy solution: make a convar to toggle it off for those few advanced users so everyone wins (it's up to debate if you add the archive flag to it)
Also you can proxy stuff around by using the loopback interface to selectively whitelist a service
Bo98 commentedon Dec 17, 2018
Also, it could just be limited clientside if necessary.
Velkon commentedon Dec 18, 2018
This is a great example of the dangers with saying "what if".
Trying to use this as an actual exploit to attack people is simply impractical and nearly impossible.
Blocking it would be useless and would just hinder actual uses, like local webservers.
h3xcat commentedon Dec 18, 2018
Oh really? You don't think I could write worm of some kind?
Velkon commentedon Dec 18, 2018
Yes, you couldn't.
thegrb93 commentedon Dec 18, 2018
I honestly don't. Not with a http request alone.
h3xcat commentedon Dec 18, 2018
I might aswell just avoid doing it everything through Lua and allow remote access to the routers... And then manage them remotely.
This could be happening as we speaking right now, if the attacker is smart, he'll stay quiet. Unlike as it was with the cough cough worm.
There is also the workshop, just have a popular workshop addon, or multiple of small, and just inject your exploit code.
That's just few uses case, there's probably shit ton of others. This kind of shit is what allowed Mirai virus to get spread...
thegrb93 commentedon Dec 18, 2018
That'd be one really shit router. Again though, any other app would be able to do that too.
h3xcat commentedon Dec 18, 2018
I'm yet to see an app that could do that, that is which you wouldn't have control over what requests are being ran, other than GMod.
And most people have a shitty routers, in general most consumer routers don't consider security seriously. Just because you might have fancy one, doesn't mean everyone else has such. Again, rare cases, by few users.
Ask any security professional if they'd allow anyone to bring their routers to their business environment, they'll instantly say no. There are other reasons too, but web interface+consumer grade are also one of the reasons.
thegrb93 commentedon Dec 18, 2018
Sorry, I just can't get behind it. Update your routers, they're probably already running Chinese/Russian botnet code if they are that vulnerable.
18 remaining items
adosikas commentedon Dec 26, 2018
IMO the router/NAS/LAN attacks aren't even the biggest problem here.
Clientside HTTP means that servers you join (or a rogue admins with lua access) can make your computer request any arbitrary site in the background (including JS-Cryptominers, IP-loggers, Jailbait or just huge/many files to clog your connection/DDOS the host).
This issue becomes much more dangerous with certain addons allowing normal players to do this to any/all players. @thegrb93 's Starfall used to have this problem in the default config for years (and you can still trick people to toggle a checkbox that effectively enables a full http proxy through that players connection) and I think PAC3 and several of the "streaming/mediaplayer" addons allow all players to make all other players request completely arbitrary locations.
DBotThePony commentedon Dec 26, 2018
Everything can be exploited if you are brave enough. If you are scared of "bad usage" of any feature of any program, you better turn off your pc and go outside forever, to life without digital computers.
WinterPhoenix commentedon Dec 28, 2018
Rubat, with all due respect, that is not a good idea.
Disabling the JS<->Lua bridge and removing HTTP from clients singlehandedly breaks an incredible amount of stuff, including much of the work myself and others have spent years making.
The theoretical security issues do not outweigh the functionality we would lose as a result. Going down the path of removing web functionality is going to totally gimp GMod's capabilities in this web-based world.
Instead, if I may suggest an alternative, simply have GMod figure out what the local network(s) are, and don't allow HTTP or the web framework to access anything on those networks.
Maybe even just blacklist all of the Private IP address blocks.
These options would limit some functionality still, but it's way better than flat out breaking most of Media Player/Cinema/anything that uses this stuff.
You could even maybe make a (blocked) ConVar that developers can toggle if they need to access stuff on their local network.
Please reconsider.
h3xcat commentedon Dec 30, 2018
Implementation wise,
HTTP()shouldn't be difficult to patch. Just resolve the domain before making an actual request and check if the IP address is private or not. Though, I don't know how specifically GMod handlesHTTP, more specifically in cases such as 301 redirects.Now with stuff like chromium/awesomium specifically, it might be harder to implement such protection. Since a lot of separate requests are made from within a single web page, including: javascript, css, images, and etc. So checking initial request wouldn't be enough.
One way I could possibly see this easily implemented is creating a custom localhost proxy server on the system, and configuring the chromium to go through that proxy. The proxy would check the request packets and block the ones made to private networks.
The proxy server would be part of the game, possibly loaded by a linked-library when the game starts. And having an option to bypass the proxy checker with a cvar wouldn't be difficult to implement.
Note: I haven't used chromium framework before, but I'd believe it would support proxies as any other browser currently does.
adosikas commentedon Dec 31, 2018
301 Redirects are definitely followed by http.Fetch, which also means you can bypass most "sanitizers" by just pointing to a url-shortener which leads to whatever host, ip, port or GET-parameters you want.
And if you already into proxy-territory one might as well proxy via the server itself.
h3xcat commentedon Jan 1, 2019
There are issues by having a proxy on game server.
latency(client<->game_server)+latency(game_server<->web_server)instead of justlatency(client<->web_server)I could go on and on... But this should be a plenty of reasons why not to host the proxy server-side.
h3xcat commentedon Dec 10, 2020
ajloveslily14 commentedon Dec 10, 2020
Can't wait for the next *cough* virus
Velkon commentedon Dec 11, 2020
This is a waste of time
ajloveslily14 commentedon Dec 11, 2020
Keep saying that until you join a server and suddenly your router is apart of a botnet