diff --git a/Robust.Server/Scripting/ScriptHost.cs b/Robust.Server/Scripting/ScriptHost.cs index e4dd9115e29..c04ad9e8381 100644 --- a/Robust.Server/Scripting/ScriptHost.cs +++ b/Robust.Server/Scripting/ScriptHost.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; @@ -138,6 +139,22 @@ private async void ReceiveScriptEval(MsgScriptEval message) var replyMessage = new MsgScriptResponse(); replyMessage.ScriptSession = message.ScriptSession; + // Safety check. There's no reason most production servers should allow remote code execution IMO, + // especially since it is not sandboxed. If you really need it, enable the environment variable. + if (Environment.GetEnvironmentVariable("ALLOW_RCE_VIA_SCSI") != "YES") + { + string deniedMessage = "SCSI is disabled by default in MV. Set ALLOW_RCE_VIA_SCSI=YES environment variable to use it. Be aware this allows remote code execution on your server."; + _sawmill.Warning(deniedMessage, session); + + replyMessage.Echo = new FormattedMessage(); + replyMessage.Response = new FormattedMessage(); + replyMessage.Response.AddText(deniedMessage); + replyMessage.WasComplete = true; + _netManager.ServerSendMessage(replyMessage, message.MsgChannel); + + return; + } + var code = message.Code; if (code == "y" && instance.AutoImportRepeatBuffer.HasValue)