CVE-2023-34237 (published 2023-06-07T20:15Z)

SABnzbd is an open source automated Usenet download tool. A design flaw was discovered in SABnzbd that could allow remote code execution. Manipulating the Parameters setting in the Notification Script functionality allows code execution with the privileges of the SABnzbd process. Exploiting the vulnerabilities requires access to the web interface. Remote exploitation is possible if users[exposed their setup to the internet or other untrusted networks without setting a username/password. By default SABnzbd is only accessible from `localhost`, with no authentication required for the web interface. This issue has been patched in commits `e3a722` and `422b4f` which have been included in the 4.0.2 release. Users are advised to upgrade. Users unable to upgrade should ensure that a username and password have been set if their instance is web accessible.

CVSS v3 base score: 9.8, CRITICAL (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)

Weakness information:
cwe_id: NVD-CWE-noinfo
cwe_name: Insufficient Information
description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
extended_description: Insufficient Information

Fix information:
repo_url: https://github.com/sabnzbd/sabnzbd
commit_details: repo_url: https://github.com/sabnzbd/sabnzbd
author: Safihre
author_date: 2023-05-31 21:16:15+02:00
msg: Notification Script did not get environment variables
repository: repo_url: https://github.com/sabnzbd/sabnzbd
repo_name: sabnzbd/sabnzbd
description: SABnzbd - The automated Usenet download tool
repo_language: Python
owner: sabnzbd
file_changes: filename: newsunpack.py
change_type: ModificationType.MODIFY
diff: @@ -1908,9 +1908,6 @@ def create_env(nzo: Optional[NzbObject] = None, extra_env_fields: Dict[str, Any]
             del env["PYTHONPATH"]
         if "PYTHONHOME" in env:
             del env["PYTHONHOME"]
-    elif not nzo:
-        # No modification
-        return None
 
     return env
 

programming_language: Python
filename: notifier.py
change_type: ModificationType.MODIFY
diff: @@ -350,10 +350,10 @@ def send_nscript(title, msg, gtype, force=False, test=None):
     """Run user's notification script"""
     if test:
         script = test.get("nscript_script")
-        env = {"notification_parameters": test.get("nscript_parameters")}
+        env_params = {"notification_parameters": test.get("nscript_parameters")}
     else:
         script = sabnzbd.cfg.nscript_script()
-        env = {"notification_parameters": sabnzbd.cfg.nscript_parameters()}
+        env_params = {"notification_parameters": sabnzbd.cfg.nscript_parameters()}
 
     if not script:
         return T("Cannot send, missing required data")
@@ -365,17 +365,18 @@ def send_nscript(title, msg, gtype, force=False, test=None):
             ret = -1
             output = None
             try:
-                p = build_and_run_command([script_path, gtype, title, msg], env=create_env(extra_env_fields=env))
+                p = build_and_run_command([script_path, gtype, title, msg], env=create_env(extra_env_fields=env_params))
                 output = p.stdout.read()
                 ret = p.wait()
             except:
-                logging.info("Failed script %s, Traceback: ", script, exc_info=True)
+                logging.info("Failed to run script %s", script, exc_info=True)
 
             if ret:
                 logging.error(T('Script returned exit code %s and output "%s"'), ret, output)
                 return T('Script returned exit code %s and output "%s"') % (ret, output)
             else:
                 logging.info("Successfully executed notification script %s", script_path)
+                logging.debug("Script output: %s", output)
         else:
             return T('Notification script "%s" does not exist') % script_path
     return ""

programming_language: Python
repo_url: https://github.com/sabnzbd/sabnzbd
commit_details: repo_url: https://github.com/sabnzbd/sabnzbd
author: Safihre
author_date: 2023-05-31 11:31:34+02:00
msg: Move Notification Script Parameters to environment variable

Fixes #2549
repository: repo_url: https://github.com/sabnzbd/sabnzbd
repo_name: sabnzbd/sabnzbd
description: SABnzbd - The automated Usenet download tool
repo_language: Python
owner: sabnzbd
file_changes: filename: notifier.py
change_type: ModificationType.MODIFY
diff: @@ -350,11 +350,11 @@ def send_nscript(title, msg, gtype, force=False, test=None):
     """Run user's notification script"""
     if test:
         script = test.get("nscript_script")
-        nscript_parameters = test.get("nscript_parameters")
+        env = {"notification_parameters": test.get("nscript_parameters")}
     else:
         script = sabnzbd.cfg.nscript_script()
-        nscript_parameters = sabnzbd.cfg.nscript_parameters()
-    nscript_parameters = nscript_parameters.split()
+        env = {"notification_parameters": sabnzbd.cfg.nscript_parameters()}
+
     if not script:
         return T("Cannot send, missing required data")
     title = "SABnzbd: " + T(NOTIFICATION.get(gtype, "other"))
@@ -365,7 +365,7 @@ def send_nscript(title, msg, gtype, force=False, test=None):
             ret = -1
             output = None
             try:
-                p = build_and_run_command([script_path, gtype, title, msg] + nscript_parameters, env=create_env())
+                p = build_and_run_command([script_path, gtype, title, msg], env=create_env(extra_env_fields=env))
                 output = p.stdout.read()
                 ret = p.wait()
             except:

programming_language: Python