GHSA-98hq-4wmw-98w9

Suggest an improvement
Source
https://github.com/advisories/GHSA-98hq-4wmw-98w9
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/02/GHSA-98hq-4wmw-98w9/GHSA-98hq-4wmw-98w9.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-98hq-4wmw-98w9
Aliases
Published
2023-02-10T23:52:13Z
Modified
2024-12-07T05:38:02.210852Z
Severity
  • 8.2 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H CVSS Calculator
Summary
Arbitrary code execution in de.tum.in.ase:artemis-java-test-sandbox
Details

Summary

Because of the missing checkLink(String) override in the SecurityManager, students can load libraries and execute arbitrary code.

Details

Using System.load(String) or System.loadLibrary​(String) students can load and execute arbitrary code.

private static native void start(List<String> args);

public static void main(String[] args) {
  System.load(new File("path_to_lib.so").getAbsolutePath());
  start(List.of(args));
}

Adding this to the security manager (and a translation) should fix the issue:

@Override
public void checkExec(String cmd) {
  try {
    if (enterPublicInterface())
      return;
    throw new SecurityException(localized("security.error_link")); //$NON-NLS-1$
  } finally {
    exitPublicInterface();
  }
}

PoC

See details.

Impact

Arbitrary code execution.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-284"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2023-02-10T23:52:13Z"
}
References

Affected packages

Maven / de.tum.in.ase:artemis-java-test-sandbox

Package

Name
de.tum.in.ase:artemis-java-test-sandbox
View open source insights on deps.dev
Purl
pkg:maven/de.tum.in.ase/artemis-java-test-sandbox

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.11.2

Affected versions

1.*

1.0.0
1.0.1
1.1.0
1.1.1
1.2.0
1.2.1
1.2.2
1.3.0
1.3.1
1.3.2
1.3.3
1.3.4
1.4.0
1.4.1
1.4.2
1.4.3
1.4.4
1.4.5
1.4.6
1.4.7
1.5.0
1.5.1
1.5.2
1.5.3
1.5.4
1.5.5
1.6.0
1.7.0
1.7.1
1.7.2
1.7.3
1.7.5
1.7.6
1.8.0
1.9.0
1.9.1
1.9.2
1.10.0
1.10.1
1.11.0
1.11.1