Skip to content
This repository has been archived by the owner on Dec 21, 2022. It is now read-only.

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in connect_to_server.py

High
benjjvi published GHSA-mjv7-r62p-vhhg Feb 3, 2022

Package

connect_to_server.py (Client)

Affected versions

>private.debug.3.0.0

Patched versions

None

Description

Impact

What kind of vulnerability is it? Who is impacted?
Any user running source commits 3fa8bbf, 1bda8d1, 12a9590, 428b361, 34fb194, b521636, ef3583e, f5efa6a, 1eb1e54, and cbcea0a are vulnerable.

Patches

Has the problem been patched? What versions should users upgrade to?
There are no published patches as of yet. As of commit cdcd48b the issue has been fixed. Users on patches between 3fa8bbf and cbcea0a are advised to update as soon as possible.

Workarounds

Is there a way for users to fix or remediate the vulnerability without upgrading?
Users can manually modify the source code to ensure that the image_file variable is evaluated with ast.literal_eval to convert to a string, then passed through werkzeug.utils.secure_filename to ensure the filename is correct. The manually modified source should look like this;

    [module/connect_to_server.py]
    [...]
    from html import unescape
    import werkzeug.utils

    import requests

    image_file = str(image_file).replace("DOT", ".") # <-- modified line

    api = f"http://{domain}:7873/bGVhdmVfcmlnaHRfbm93"
    [...]

This modification also requires itunesrpc.py to be modified to pass through file names, not file paths.

    [itunesrpc.py]
    [...]
    # MODIFY TRACK TO HAVE PAUSED IF PAUSED ON APPLE MUSIC
    if paused_track:
        track = "[PAUSED] " + track

    file_path = os.getcwd() + "\\temporary.png" # <- pay attention to this line
    o.CurrentTrack.Artwork.Item(1).SaveArtworkToFile(file_path)

    artwork_url = networking.get("temporaryDOTpng", domain, track, artist, album) # <- pay attention to this line
    artwork_url = ast.literal_eval(str(artwork_url))
    [...]

Although this modification is "quick and dirty" it gets the job done. It is the definition of "spaghetti code" and will be fixed to be properly written before the release of debug.4.0.0

References

CWE-78

For more information

If you have any questions or comments about this advisory:

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
High
Privileges required
None
User interaction
None
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:H

CVE ID

CVE-2022-23611

Weaknesses