CVE-2023-34237: Insufficient Information (NVD-CWE-noinfo)
value: 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.
CWE description: There is insufficient information about the issue to classify it; details are unkown or unspecified.
CVSS v3 base score: 9.8
Published: 2023-06-07T20:15Z
Repository: https://github.com/sabnzbd/sabnzbd
Language: Python
Files changed: sabnzbd/newsunpack.py, sabnzbd/notifier.py
Commit date: 2023-05-31 21:16:15 +0200
Commit message: Notification Script did not get environment variables
Diff: diff --git a/sabnzbd/newsunpack.py b/sabnzbd/newsunpack.py
index ceb7f3a15..38feb2704 100644
--- a/sabnzbd/newsunpack.py
+++ b/sabnzbd/newsunpack.py
@@ -1906,13 +1906,10 @@ def create_env(nzo: Optional[NzbObject] = None, extra_env_fields: Dict[str, Any]
     if sabnzbd.MACOS:
         if "PYTHONPATH" in env:
             del env["PYTHONPATH"]
         if "PYTHONHOME" in env:
             del env["PYTHONHOME"]
-    elif not nzo:
-        # No modification
-        return None
 
     return env
 
 
 def rar_volumelist(rarfile_path: str, password: str, known_volumes: List[str]) -> List[str]:
diff --git a/sabnzbd/notifier.py b/sabnzbd/notifier.py
index 455c71332..654fdbbda 100644
--- a/sabnzbd/notifier.py
+++ b/sabnzbd/notifier.py
@@ -348,14 +348,14 @@ def send_pushbullet(title, msg, gtype, force=False, test=None):
 
 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")
     title = "SABnzbd: " + T(NOTIFICATION.get(gtype, "other"))
 
@@ -363,21 +363,22 @@ def send_nscript(title, msg, gtype, force=False, test=None):
         script_path = make_script_path(script)
         if script_path:
             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 ""
 
 

Vulnerable code:     elif not nzo:
        # No modification
        return None
        env = {"notification_parameters": test.get("nscript_parameters")}
        env = {"notification_parameters": sabnzbd.cfg.nscript_parameters()}
                p = build_and_run_command([script_path, gtype, title, msg], env=create_env(extra_env_fields=env))
                logging.info("Failed script %s, Traceback: ", script, exc_info=True)
Fixed code:         env_params = {"notification_parameters": test.get("nscript_parameters")}
        env_params = {"notification_parameters": sabnzbd.cfg.nscript_parameters()}
                p = build_and_run_command([script_path, gtype, title, msg], env=create_env(extra_env_fields=env_params))
                logging.info("Failed to run script %s", script, exc_info=True)
                logging.debug("Script output: %s", output)