Raised This Month: $17 Target: $400
 4% 

Security question ... what can source mode access on a windows machine ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghostdlr
Member
Join Date: Aug 2010
Old 05-31-2020 , 17:25   Security question ... what can source mode access on a windows machine ?
Reply With Quote #1

Hello guys. I have a dedicated server with Windows server 2019 and I want to host a CS GO server for someone.

I also have my stuff running there, some websites and files. Is there any security risk if I host that CS GO server?

Can source mod plugins list and read files from disk outside cs go server folder? Can it get info about running processes or any information about the machine ?
ghostdlr is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 06-01-2020 , 04:25   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #2

Quote:
Originally Posted by ghostdlr View Post
Hello guys. I have a dedicated server with Windows server 2019 and I want to host a CS GO server for someone.

I also have my stuff running there, some websites and files. Is there any security risk if I host that CS GO server?

Can source mod plugins list and read files from disk outside cs go server folder? Can it get info about running processes or any information about the machine ?
No chance of deleting / accessing anything the user can't access I believe. Wait for the experts if you're still afraid.
__________________
Accepting private work. Contact me if you're interested.
If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

Total Donated: 10$
eyal282 is offline
Crasher_3637
AlliedModders Donor
Join Date: May 2012
Old 06-01-2020 , 06:05   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #3

As far as I know, SM can only access files located in folders relative to the path of SM and the game's mod (tf, csgo, left4dead, left4dead2, etc.) folder. SM will not be able to access anything outside of the server's game folder, so I wouldn't worry about plugins potentially retrieving your personal/confidential files.
__________________
AFK like JFK
Crasher_3637 is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 06-01-2020 , 08:57   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #4

The SourceMod plugin runtime is not sandboxed, plugins can access anything that the SRCDS process can access (which is probably going to be the same as anything the user running SRCDS can access).

You should treat a compiled plugin as you would any other executable code. If you're talking vulnerabilities rather than intentionally malicious code (all SourceMod plugins are legally required to be distributed with source code, so you can always audit and compile them yourself), I'd be a lot more wary of SRCDS itself personally.

There's no great risk here, just isolate SRCDS as you would any other server daemon.
__________________
asherkin is offline
ghostdlr
Member
Join Date: Aug 2010
Old 06-01-2020 , 15:07   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #5

Not sure how to isolate it on windows server. Any ideas?
ghostdlr is offline
TomL.
Senior Member
Join Date: Oct 2017
Location: Germany
Old 06-01-2020 , 15:18   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #6

There are many ways e.g. windows users and groups permissions, Docker/Hyper-V, sandbox software etc.
TomL. is offline
ghostdlr
Member
Join Date: Aug 2010
Old 06-01-2020 , 16:47   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #7

Did anyone try to use sandboxie for running srcds ? Is it a good idea ?

Last edited by ghostdlr; 06-01-2020 at 16:47.
ghostdlr is offline
TomL.
Senior Member
Join Date: Oct 2017
Location: Germany
Old 06-01-2020 , 23:43   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #8

You can use it.
TomL. is offline
LaGgLs
Senior Member
Join Date: Apr 2015
Location: sweden
Old 06-02-2020 , 13:43   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #9

You are 100% safe to use that its no change sourcemod can read files in that way
LaGgLs is offline
Balimbanana
Member
Join Date: Jan 2017
Old 06-02-2020 , 19:29   Re: Security question ... what can source mode access on a windows machine ?
Reply With Quote #10

I think you should definitely sandbox it. Here is an example of being able to list directories and read files (to the extent of what the user that launched srcds.exe can access):
Code:
#include <sourcemod>

public void OnPluginStart()
{
	RegAdminCmd("ls",lsdir,ADMFLAG_ROOT,".");
	RegAdminCmd("cat",catfile,ADMFLAG_ROOT,".");
}

public Action lsdir(int client, int args)
{
	if (args > 0)
	{
		char szDir[256];
		GetCmdArgString(szDir,sizeof(szDir));
		if (DirExists(szDir,true,NULL_STRING))
		{
			Handle hDirListing = OpenDirectory(szDir,true,NULL_STRING);
			if (hDirListing != INVALID_HANDLE)
			{
				char buff[64];
				while (ReadDirEntry(hDirListing, buff, sizeof(buff)))
				{
					if ((!(StrEqual(buff, "."))) && (!(StrEqual(buff, ".."))))
						PrintToConsole(client,"%s/%s",szDir,buff);
				}
			}
			CloseHandle(hDirListing);
		}
		else PrintToConsole(client,"Directory '%s' does not exist.",szDir);
	}
	return Plugin_Handled;
}

public Action catfile(int client, int args)
{
	if (args > 0)
	{
		char szFile[256];
		GetCmdArgString(szFile,sizeof(szFile));
		if (FileExists(szFile,true,NULL_STRING))
		{
			Handle hFile = OpenFile(szFile,"r",true,NULL_STRING);
			if (hFile != INVALID_HANDLE)
			{
				char line[256];
				while(!IsEndOfFile(hFile)&&ReadFileLine(hFile,line,sizeof(line)))
				{
					ReplaceString(line,sizeof(line),"\n","",false);
					PrintToConsole(client,"%s",line);
				}
			}
			CloseHandle(hFile);
		}
		else PrintToConsole(client,"File '%s' does not exist.",szFile);
	}
	return Plugin_Handled;
}
Then as an example, lets assume the server is installed at:
C:\SteamCMD\steamapps\common\CSGO\csgo
and you have a web server at:
C:\webserver
Code:
This would list the directory contents
ls ../../../../../webserver/htdocs
This could read a .htaccess file at the root of htdocs
cat ../../../../../webserver/htdocs/.htaccess
You could even modify the code to open in "r+" or "w" and overwrite files there. If it was just for a friend, you probably wouldn't need to worry about them doing things like this, but if they have random admins on their server that could add plugins, definitely sandbox it.
Balimbanana is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:06.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode