From 829a5fe039768c74d1fbbd88eace856ee14d08d6 Mon Sep 17 00:00:00 2001 From: "OpenGenesis (MPL 2.0)" <153564363+opengenesislink@users.noreply.github.com> Date: Wed, 14 Oct 2026 22:57:19 +0200 Subject: [PATCH] security(asset): permanently eliminate HTTP asset deletion (#214) * security(asset): eliminate externally configurable HTTP asset deletion * security(asset): remove outgoing HTTP delete from remote asset connector * security(asset): remove obsolete delete handler from build * security(asset): delete insecure HTTP DELETE handler implementation * security(config): remove unsafe remote asset deletion switches from bin/Robust.ini.example * security(config): remove unsafe remote asset deletion switches from bin/Robust.HG.ini.example * security(config): remove unsafe remote asset deletion switches from bin/Robust.HG.ini * security(config): remove unsafe remote asset deletion switches from bin/Robust.Tests.ini * test(security): permanently guard absent remote asset deletion paths * ci(security): reject reintroduction of remote asset deletion * docs(security): explain permanent remote asset DELETE removal and operator response * test(security): ensure legacy asset delete option names are absent from runtime code --- .github/workflows/nexjast-ci.yml | 4 + .../Handlers/Asset/AssetServerConnector.cs | 24 +--- .../Asset/AssetServerDeleteHandler.cs | 115 ------------------ .../Handlers/OpenSim.Server.Handlers.csproj | 1 - .../Asset/AssetServicesConnector.cs | 11 +- bin/Robust.HG.ini | 14 +-- bin/Robust.HG.ini.example | 14 +-- bin/Robust.Tests.ini | 15 +-- bin/Robust.ini.example | 14 +-- .../09312_REMOTE_ASSET_DELETE_REMOVAL.md | 78 ++++++++++++ .../ci/verify_no_remote_asset_delete_09312.py | 46 +++++++ 11 files changed, 145 insertions(+), 191 deletions(-) delete mode 100644 OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs create mode 100644 doc/OpenGenesisLINK/09312_REMOTE_ASSET_DELETE_REMOVAL.md create mode 100644 tools/ci/verify_no_remote_asset_delete_09312.py diff --git a/.github/workflows/nexjast-ci.yml b/.github/workflows/nexjast-ci.yml index 468cae8d..01db1440 100644 --- a/.github/workflows/nexjast-ci.yml +++ b/.github/workflows/nexjast-ci.yml @@ -99,6 +99,10 @@ jobs: shell: bash run: python3 tools/ci/verify_hg_inventory_security_09312.py + - name: Security - remote asset deletion must be absent + shell: bash + run: python3 tools/ci/verify_no_remote_asset_delete_09312.py + - name: Verify runtime secrets are not committed shell: bash run: python3 tools/ci/verify_no_plaintext_runtime_secrets.py diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 3f796cce..c6de96b5 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -65,30 +65,16 @@ namespace OpenSim.Server.Handlers.Asset if (m_AssetService == null) throw new Exception(string.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); - bool allowDelete = serverConfig.GetBoolean("AllowRemoteDelete", false); - bool allowDeleteAllTypes = serverConfig.GetBoolean("AllowRemoteDeleteAllTypes", false); - string redirectURL = serverConfig.GetString("RedirectURL", string.Empty); - - AllowedRemoteDeleteTypes allowedRemoteDeleteTypes; - - if (!allowDelete) - { - allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.None; - } - else - { - if (allowDeleteAllTypes) - allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.All; - else - allowedRemoteDeleteTypes = AllowedRemoteDeleteTypes.MapTile; - } - IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); + // OGL SECURITY: Intentionally do NOT register HTTP DELETE /assets. + // This endpoint was capable of deleting every asset type when enabled + // by legacy settings, including when a public asset listener was exposed. + // Old remote-delete settings in external .ini files have no effect. + // Local maintenance remains exclusively an operator-console operation. server.AddStreamHandler(new AssetServerGetHandler(m_AssetService, auth, redirectURL)); server.AddStreamHandler(new AssetServerPostHandler(m_AssetService, auth)); - server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowedRemoteDeleteTypes, auth)); server.AddStreamHandler(new AssetsExistHandler(m_AssetService)); MainConsole.Instance.Commands.AddCommand("Assets", false, diff --git a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs b/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs deleted file mode 100644 index d85d4713..00000000 --- a/OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using Nini.Config; -using log4net; -using System; -using System.Reflection; -using System.IO; -using System.Net; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Serialization; -using OpenSim.Server.Base; -using OpenSim.Services.Interfaces; -using OpenSim.Framework; -using OpenSim.Framework.ServiceAuth; -using OpenSim.Framework.Servers.HttpServer; - -namespace OpenSim.Server.Handlers.Asset -{ - /// - /// Remote deletes allowed. - /// - public enum AllowedRemoteDeleteTypes - { - None, - MapTile, - All - } - - public class AssetServerDeleteHandler : BaseStreamHandler - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private IAssetService m_AssetService; - - /// - /// Asset types that can be deleted remotely. - /// - private AllowedRemoteDeleteTypes m_allowedTypes; - - public AssetServerDeleteHandler(IAssetService service, AllowedRemoteDeleteTypes allowedTypes) : - base("DELETE", "/assets") - { - m_AssetService = service; - m_allowedTypes = allowedTypes; - } - - public AssetServerDeleteHandler(IAssetService service, AllowedRemoteDeleteTypes allowedTypes, IServiceAuth auth) : - base("DELETE", "/assets", auth) - { - m_AssetService = service; - m_allowedTypes = allowedTypes; - } - protected override byte[] ProcessRequest(string path, Stream request, - IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) - { - bool result = false; - - string[] p = SplitParams(path); - - if (p.Length > 0) - { - if (m_allowedTypes != AllowedRemoteDeleteTypes.None) - { - string assetID = p[0]; - - AssetBase asset = m_AssetService.Get(assetID); - if (asset != null) - { - if (m_allowedTypes == AllowedRemoteDeleteTypes.All - || (int)(asset.Flags & AssetFlags.Maptile) != 0) - { - result = m_AssetService.Delete(assetID); - } - else - { - m_log.DebugFormat( - "[ASSET SERVER DELETE HANDLER]: Request to delete asset {0}, but type is {1} and allowed remote delete types are {2}", - assetID, (AssetFlags)asset.Flags, m_allowedTypes); - } - } - } - } - - XmlSerializer xs = new XmlSerializer(typeof(bool)); - return ServerUtils.SerializeResult(xs, result); - } - } -} \ No newline at end of file diff --git a/OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj b/OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj index d583fc05..96f969a2 100644 --- a/OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj +++ b/OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj @@ -223,7 +223,6 @@ Code - Code diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 0f2fe461..3af434de 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -418,13 +418,10 @@ namespace OpenSim.Services.Connectors public virtual bool Delete(string id) { - m_Cache?.Expire(id); - - if (m_ServerURI == null) - return false; - - string uri = m_ServerURI + "/assets/" + id; - return SynchronousRestObjectRequester.MakeRequest("DELETE", uri, 0, m_Auth); + // OGL SECURITY: IAssetService still declares Delete for in-process + // maintenance, but the REMOTE asset connector must never initiate + // an HTTP DELETE call. There is no configuration override. + return false; } public void Get(string id, string ForeignAssetService, bool StoreOnLocalGrid, SimpleAssetRetrieved callBack) { diff --git a/bin/Robust.HG.ini b/bin/Robust.HG.ini index f52e230d..0dd3831b 100644 --- a/bin/Robust.HG.ini +++ b/bin/Robust.HG.ini @@ -361,19 +361,9 @@ DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" AssetLoaderArgs = "./assets/AssetSets.xml" - ; Allow maptile assets to remotely deleted by remote calls to the asset service. - ; There is no harm in having this as false - it just means that historical maptile assets are not deleted. - ; This only applies to maptiles served via the version 1 viewer mechanisms - ; Default is false - AllowRemoteDelete = false - - ; Allow all assets to be remotely deleted. - ; Only set this to true if you are operating a grid where you control all calls to the asset service - ; (where a necessary condition is that you control all simulators) and you need this for admin purposes. - ; If set to true, AllowRemoteDelete = true is required as well. - ; Default is false. - AllowRemoteDeleteAllTypes = false + ; OpenGenesisLINK security: HTTP DELETE /assets is permanently unavailable. + ; Obsolete remote asset deletion settings are ignored, even if an old INI enables them. ; * This configuration loads the inventory server modules. It duplicates ; * the function of the legacy inventory server ; * diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 49f655da..a0e51f2b 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -365,19 +365,9 @@ DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" AssetLoaderArgs = "./assets/AssetSets.xml" - ; Allow maptile assets to remotely deleted by remote calls to the asset service. - ; There is no harm in having this as false - it just means that historical maptile assets are not deleted. - ; This only applies to maptiles served via the version 1 viewer mechanisms - ; Default is false - AllowRemoteDelete = false - - ; Allow all assets to be remotely deleted. - ; Only set this to true if you are operating a grid where you control all calls to the asset service - ; (where a necessary condition is that you control all simulators) and you need this for admin purposes. - ; If set to true, AllowRemoteDelete = true is required as well. - ; Default is false. - AllowRemoteDeleteAllTypes = false + ; OpenGenesisLINK security: HTTP DELETE /assets is permanently unavailable. + ; Obsolete remote asset deletion settings are ignored, even if an old INI enables them. ; * This configuration loads the inventory server modules. It duplicates ; * the function of the legacy inventory server ; * diff --git a/bin/Robust.Tests.ini b/bin/Robust.Tests.ini index d2ee8cb3..3ffd98c3 100644 --- a/bin/Robust.Tests.ini +++ b/bin/Robust.Tests.ini @@ -130,20 +130,9 @@ LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" DefaultAssetLoader = "" - ; Allow maptile assets to remotely deleted by remote calls to the asset service. - ; There is no harm in having this as false - it just means that historical maptile assets are not deleted. - ; This only applies to maptiles served via the version 1 viewer mechanisms - ; Default is false - AllowRemoteDelete = false - - ; Allow all assets to be remotely deleted. - ; Only set this to true if you are operating a grid where you control all calls to the asset service - ; (where a necessary condition is that you control all simulators) and you need this for admin purposes. - ; If set to true, AllowRemoteDelete = true is required as well. - ; Default is false. - AllowRemoteDeleteAllTypes = false - + ; OpenGenesisLINK security: HTTP DELETE /assets is permanently unavailable. + ; Obsolete remote asset deletion settings are ignored, even if an old INI enables them. ; * This configuration loads the inventory server modules. It duplicates ; * the function of the legacy inventory server ; * diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 5e044369..0c0a782d 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -310,19 +310,9 @@ DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll" AssetLoaderArgs = "./assets/AssetSets.xml" - ; Allow maptile assets to remotely deleted by remote calls to the asset service. - ; There is no harm in having this as false - it just means that historical maptile assets are not deleted. - ; This only applies to maptiles served via the version 1 viewer mechanisms - ; Default is false - AllowRemoteDelete = false - - ; Allow all assets to be remotely deleted. - ; Only set this to true if you are operating a grid where you control all calls to the asset service - ; (where a necessary condition is that you control all simulators) and you need this for admin purposes. - ; If set to true, AllowRemoteDelete = true is required as well. - ; Default is false. - AllowRemoteDeleteAllTypes = false + ; OpenGenesisLINK security: HTTP DELETE /assets is permanently unavailable. + ; Obsolete remote asset deletion settings are ignored, even if an old INI enables them. ; * This configuration loads the inventory server modules. It duplicates ; * the function of the legacy inventory server ; * diff --git a/doc/OpenGenesisLINK/09312_REMOTE_ASSET_DELETE_REMOVAL.md b/doc/OpenGenesisLINK/09312_REMOTE_ASSET_DELETE_REMOVAL.md new file mode 100644 index 00000000..e9bbff26 --- /dev/null +++ b/doc/OpenGenesisLINK/09312_REMOTE_ASSET_DELETE_REMOVAL.md @@ -0,0 +1,78 @@ +# OpenGenesisLINK – Entfernung der Remote-Asset-Löschfunktion + +**Sicherheitsänderung / 0.9.3.12 nach Tag-Erstellung** + +## Befund und Bedrohungsmodell + +Der bisherige ROBUST-Asset-HTTP-Dienst registrierte einen Handler für +`DELETE /assets/{assetId}`. Über zwei historische Konfigurationsschalter +konnte der Handler Remote-Löschungen erlauben. Bei Freigabe aller +Asset-Typen ließ sich jedes über diesen Dienst erreichbare Asset-ID-Ziel +löschen. Eine ausreichend privilegierte oder ungeschützte +Netzwerkverbindung zum Asset-Dienst stellt damit eine gefährliche +Löschoberfläche dar. + +Diese Quellcodefeststellung belegt **keinen** tatsächlichen Malware-Vorfall +auf einem bestimmten Grid und noch keinen alleinigen Zusammenhang mit +einem LSL-Skript. Die Angriffsbedingungen hängen von Listener-Exposition, +HTTP-Authentifizierung, alten INI-Dateien, Netzwerkzugriff und +möglichen zusätzlichen Schwachstellen ab. Das Risiko ist dennoch +hoch und die exponierte Löschfunktion unnötig. + +## Dauerhafte Entfernung + +1. Die historische Klasse `AssetServerDeleteHandler` einschließlich des + Typs `AllowedRemoteDeleteTypes` ist aus Quellcode und Build entfernt. +2. `AssetServiceConnector` registriert ausschließlich die verbleibenden + GET-/POST-/Existenz-Endpunkte, **keine** `DELETE /assets`-Route. +3. `AssetServicesConnector.Delete(id)` sendet keine HTTP-Anfrage mehr, + sondern gibt unveränderlich `false` zurück. Damit können auch + interne Aufrufer nicht versehentlich ein Remote-DELETE auslösen. +4. Die früheren beiden Remote-Löschschalter sind aus den ausgelieferten + ROBUST-/HG-/Testkonfigurationen entfernt und werden vom Code + grundsätzlich nicht mehr eingelesen. Selbst wenn eine ältere lokal + gepflegte INI sie weiterhin auf `true` setzt, kann sie die entfernte + Route **nicht** reaktivieren. +5. Die Funktion `delete asset ` an der lokalen, + zugriffsgeschützten ROBUST-Administratorkonsole bleibt als explizite + Betreiberwartung erhalten. Lokale `IAssetService.Delete`-Aufrufe + werden nicht pauschal entfernt. Das ist keine Remote-HTTP-Schnittstelle. + +## Betriebliche Auswirkungen + +- Das bisherige automatische Aufräumen historischer MapTile-Assets über + Remote-HTTP-DELETE ist nicht mehr möglich. Nicht mehr referenzierte + Assets müssen im Bedarfsfall über einen **lokalen**, auditierbaren und + mit Backups abgesicherten Wartungsprozess bereinigt werden. +- Normales Abrufen und Speichern von Assets über GET/POST bleibt + unverändert. Ein vollständiger Sicherheitsreview dieser anderen + Asset-Endpunkte ist von dieser Änderung nicht abgedeckt. +- **Keine alte Release-DLL verwenden:** Der bestehende GitHub-Tag + `v0.9.3.12` wurde vor diesem Patch erzeugt. Er bleibt unveränderlich. + Erst ein neu gebauter OGL-Server mit dieser Änderung ist geschützt. +- Der Schutz greift nach Deployment der neuen + `OpenSim.Server.Handlers.dll` auf ROBUST und gegebenenfalls betroffenen + Standalone-Instanzen sowie nach Neustart des laufenden Prozesses. + +## Sofortmaßnahmen für Grid-Betreiber + +1. Noch vor dem Upgrade den externen `DELETE /assets/*`-Zugriff an + Firewall oder Reverse-Proxy sperren; nicht den gesamten Asset-Abruf + sperren. Netzfreigabe des PrivatePort prüfen. +2. Verdächtige Zugriffe anhand von Reverse-Proxy-/ROBUST-Logs + untersuchen, ohne einen Vorfall allein aus der Existenz der Option + zu behaupten. +3. Vollständige Sicherung von Inventardatenbank, Asset-Datenbank, + FSAssets-Verzeichnis und Konfiguration erstellen und + Wiederherstellbarkeit stichprobenartig prüfen. +4. Gesicherte Serverfassung mit diesem Patch bauen, kontrolliert + ausrollen und neu starten. +5. Negativtest: HTTP `DELETE /assets/{testUUID}` darf **keinen** + Löschhandler erreichen und **keinen** Test-Asset-Datensatz entfernen. + Test ausschließlich in einer isolierten Testinstallation + oder mit ausdrücklich erstelltem Test-Asset durchführen. +6. `python3 tools/ci/verify_no_remote_asset_delete_09312.py` + muss erfolgreich sein. CI prüft zusätzlich den gesamten .NET-Build. + +Eine reine Änderung in `.ini` reicht bei älteren Binärdateien **nicht** +aus, um die alte Löschmöglichkeit endgültig zu beseitigen. diff --git a/tools/ci/verify_no_remote_asset_delete_09312.py b/tools/ci/verify_no_remote_asset_delete_09312.py new file mode 100644 index 00000000..c9f74c89 --- /dev/null +++ b/tools/ci/verify_no_remote_asset_delete_09312.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +"""Fail closed: OGL must not expose or initiate remote HTTP asset deletion.""" +from pathlib import Path +import re + +root = Path(__file__).resolve().parents[2] +read = lambda rel: (root / rel).read_text(encoding="utf-8") + +server = read("OpenSim/Server/Handlers/Asset/AssetServerConnector.cs") +remote = read("OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs") +project = read("OpenSim/Server/Handlers/OpenSim.Server.Handlers.csproj") + +# No REST asset DELETE handler exists at all, including its compiled class. +assert not (root / "OpenSim/Server/Handlers/Asset/AssetServerDeleteHandler.cs").exists() +assert "AssetServerDeleteHandler" not in server +assert "AssetServerDeleteHandler" not in project +assert "AllowedRemoteDeleteTypes" not in server +assert 'server.AddStreamHandler(new AssetServerGetHandler(' in server +assert 'server.AddStreamHandler(new AssetServerPostHandler(' in server + +# No client-side remote deletion via the IAssetService.Delete interface. +delete = remote.split("public virtual bool Delete(string id)", 1)[1].split( + "public void Get(", 1)[0] +assert re.search(r'^\s*\{\s*//[^\n]*\n(?:\s*//[^\n]*\n)*\s*return false;\s*\}', delete), ( + "Remote asset Delete must be an unconditional failure") +assert 'MakeRequest("DELETE"' not in remote +assert '"/assets/" + id' not in delete +assert "m_Cache?.Expire(id)" not in delete + +# Obsolete configuration switches must have no effect, even in user-owned +# legacy .ini files containing Enabled=true. No code may parse either key. +for old_key in ("AllowRemoteDeleteAllTypes", "AllowRemoteDelete"): + assert old_key not in server +for rel in ( + "bin/Robust.ini.example", + "bin/Robust.HG.ini.example", + "bin/Robust.HG.ini", + "bin/Robust.Tests.ini", +): + config = read(rel) + assert re.search(r'(?m)^\s*AllowRemoteDelete(AllTypes)?\s*=', config) is None, rel + +# Local administrative maintenance remains distinct from HTTP. +assert 'MainConsole.Instance.Commands.AddCommand("Assets", false,' in server +assert '"delete asset"' in server +print("OGL asset deletion security gate: no HTTP DELETE route/client/config switches")