GHSA-gmhj-xjfh-cf6m: Github.com/mohammed90/caddy ssh Caddy-SSH Vulnerable To Authorization Bypass Vulnerability

HIGH
CVSS 7.7
CWE-287
Published
Advisory Summary

GHSA-gmhj-xjfh-cf6m is a HIGH (CVSS 7.7) caddy-ssh vulnerable to authorization bypass vulnerability (CWE-287: Improper Authentication) affecting Github.com/mohammed90/caddy ssh libraries in the Go ecosystem. The issue involves caddy-ssh vulnerable to authorization bypass due to incorrect usage of pam library. Remediation is available in the latest vendor maintenance releases.

GHSA-gmhj-xjfh-cf6m at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-gmhj-xjfh-cf6m
Severity HIGH
CVSS v3.1 Base Score 7.7
CWE Classification CWE-287: Improper Authentication
Affected Product Github.com/mohammed90/caddy ssh
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-gmhj-xjfh-cf6m

To remediate this vulnerability, upgrade all affected Github.com/mohammed90/caddy ssh dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/mohammed90/caddy-ssh fixed: Latest secure release
Upgrade github.com/mohammed90/caddy-ssh to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/mohammed90/caddy-ssh

How to Check if You Are Affected

To determine whether your application is affected by GHSA-gmhj-xjfh-cf6m, inspect your project dependencies for Github.com/mohammed90/caddy ssh:

inspect dependencies for github.com/mohammed90/caddy-ssh

Analyze the terminal output to locate any version of Github.com/mohammed90/caddy ssh in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Github.com/mohammed90/caddy ssh, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Not invoking a call to `pam_acct_mgmt` after a call to `pam_authenticate` to check the validity of a login can lead to an authorization bypass. ### Impact #### Exploitability The attack can be carried over the network. A complex non-standard configuration or a specialized condition is required for the attack to be successfully conducted. The attacker also requires access to a users credentials, be it expired, for an attack to be successful. There is no user interaction required for successful execution. The attack can affect components outside the scope of the target module. #### Impact Using this attack vector, an attacker may access otherwise restricted parts of the system. The attack can be used to gain access to confidential files like passwords, login credentials and other secrets. Hence, it has a high impact on confidentiality. It may also be directly used to affect a change on a system resource. Hence has a medium to high impact on integrity. This attack may not be used to affect the availability of the system. Taking this account an appropriate CVSS v3.1 vector would be [AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N](https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L&version=3.1) ### Root Cause Analysis In this case, in the following PAM transaction, only a call to `pam.Authenticate` is used to login a user. https://github.com/mohammed90/caddy-ssh/blob/1d980ceea6e67765daf19b5e644c7a0773fdaa13/internal/authentication/os/pam.go#L60 This implies that a user with expired credentials can still login. The bug can be verified easily by creating a new user account, expiring it with `chage -E0 <username>` and then trying to log in with the expired credentials. ### Patches This can be fixed by invoking a call to `pam.AcctMgmt` after a successful call to `pam.Authenticate` ### References * [Man Page for pam_acct_mgmt](https://man7.org/linux/man-pages/man3/pam_acct_mgmt.3.html) * [CWE-863](http://cwe.mitre.org/data/definitions/863.html) * [CWE-285](http://cwe.mitre.org/data/definitions/285.html)

GHSA-gmhj-xjfh-cf6m Affected Github.com/mohammed90/caddy ssh Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/mohammed90/caddy-ssh
Go
0.0.1
All 1 versions
0.0.1
None specified

References

Frequently Asked Questions

What is GHSA-gmhj-xjfh-cf6m?
GHSA-gmhj-xjfh-cf6m is a security vulnerability in Github.com/mohammed90/caddy ssh involving Caddy-SSH vulnerable to Authorization Bypass due to incorrect usage of PAM library under CWE-287: Improper Authentication.
Which Github.com/mohammed90/caddy ssh versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/mohammed90/caddy-ssh.
What version fixes GHSA-gmhj-xjfh-cf6m?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/mohammed90/caddy-ssh affected?
Yes, github.com/mohammed90/caddy-ssh is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of GHSA-gmhj-xjfh-cf6m?
GHSA-gmhj-xjfh-cf6m has a CVSS v3.1 base score of 7.7 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:N.
What CWE is associated with GHSA-gmhj-xjfh-cf6m?
GHSA-gmhj-xjfh-cf6m is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check Go dependencies for GHSA-gmhj-xjfh-cf6m?
Run the dependency tree command: 'inspect dependencies for github.com/mohammed90/caddy-ssh'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-gmhj-xjfh-cf6m",
  "modified" : "2022-09-23T21:37:21Z",
  "published" : "2022-09-23T21:37:21Z",
  "aliases" : [ ],
  "summary" : "Caddy-SSH vulnerable to Authorization Bypass due to incorrect usage of PAM library",
  "details" : "Not invoking a call to `pam_acct_mgmt` after a call to `pam_authenticate` to check the validity of a login can lead to an authorization bypass.\n\n### Impact\n\n#### Exploitability\n\nThe attack can be carried over the network. A complex non-standard configuration or a specialized condition is required for the attack to be successfully conducted. The attacker also requires access to a users credentials, be it expired, for an attack to be successful. There is no user interaction required for successful execution. The attack can affect components outside the scope of the target module.\n\n#### Impact\n\nUsing this attack vector, an attacker may access otherwise restricted parts of the system. The attack can be used to gain access to confidential files like passwords, login credentials and other secrets. Hence, it has a high impact on confidentiality. It may also be directly used to affect a change on a system resource. Hence has a medium to high impact on integrity. This attack may not be used to affect the availability of the system. Taking this account an appropriate CVSS v3.1 vector would be\n[AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N](https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator?vector=AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L&version=3.1)\n\n### Root Cause Analysis\n\nIn this case, in the following PAM transaction, only a call to `pam.Authenticate` is used to login a user.\n\nhttps://github.com/mohammed90/caddy-ssh/blob/1d980ceea6e67765daf19b5e644c7a0773fdaa13/internal/authentication/os/pam.go#L60\n\nThis implies that a user with expired credentials can still login.\n\nThe bug can be verified easily by creating a new user account, expiring it with `chage -E0 <username>` and then trying to log in with the expired credentials.\n\n### Patches\nThis can be fixed by invoking a call to `pam.AcctMgmt` after a successful call to `pam.Authenticate`\n\n### References\n* [Man Page for pam_acct_mgmt](https://man7.org/linux/man-pages/man3/pam_acct_mgmt.3.html)\n* [CWE-863](http://cwe.mitre.org/data/definitions/863.html)\n* [CWE-285](http://cwe.mitre.org/data/definitions/285.html)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:C/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/mohammed90/caddy-ssh"
    },
    "versions" : [ "0.0.1" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mohammed90/caddy-ssh/security/advisories/GHSA-gmhj-xjfh-cf6m"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mohammed90/caddy-ssh/commit/4b3e639d64c55f91152ffb51a4af35a8845c95a3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mohammed90/caddy-ssh"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-23T21:37:21Z",
    "nvd_published_at" : null
  }
}