CVE-2024-9313: Github.com/ubuntu/authd PAM Module May Allow Accessing Vulnerability

HIGH
Advisory Identifier: GHSA-x5q3-c8rm-w787
CVSS 8.8
CWE-287
Published
Advisory Summary

CVE-2024-9313 is a HIGH (CVSS 8.8) pam module may allow accessing vulnerability (CWE-287: Improper Authentication) affecting Github.com/ubuntu/authd libraries in the Go ecosystem. The issue involves pam module may allow accessing with the credentials of another user. Remediation is available by upgrading affected packages to version 0.0.0-20240930103526-63e527496b01, 0.3.5.

CVE-2024-9313 at a Glance

CVE Identifier CVE-2024-9313
GHSA Identifier GHSA-x5q3-c8rm-w787
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-287: Improper Authentication
Affected Product Github.com/ubuntu/authd
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.8

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

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

How to Fix CVE-2024-9313

To remediate this vulnerability, upgrade all affected Github.com/ubuntu/authd 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/ubuntu/authd fixed: 0.0.0-20240930103526-63e527496b01
Upgrade github.com/ubuntu/authd to 0.0.0-20240930103526-63e527496b01
github.com/ubuntu/authd fixed: 0.3.5
Upgrade github.com/ubuntu/authd to 0.3.5
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/ubuntu/authd

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-9313, inspect your project dependencies for Github.com/ubuntu/authd:

inspect dependencies for github.com/ubuntu/authd

Analyze the terminal output to locate any version of Github.com/ubuntu/authd in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20240930103526-63e527496b01), 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/ubuntu/authd, 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

Authd PAM module up to version 0.3.4 can allow broker-managed users to impersonate any other user managed by the same broker and perform any PAM operation with it, including authenticating as them. This is possible using tools such as `su`, `sudo` or `ssh` (and potentially others) that, so far, do not ensure that the PAM user at the end of the transaction is matching the one who initiated the transaction. Authd 0.3.5 fixes this by not allowing changing the user unless it was never set before in the PAM stack. `su` version that will include https://github.com/util-linux/util-linux/pull/3206 will not be affected `ssh` version that will include https://github.com/openssh/openssh-portable/pull/521 will not be affected `sudo` version that will include https://github.com/sudo-project/sudo/pull/412 will not be affected `login` not affected `passwd` not affected <details> <summary>Old report</summary> ### Summary An user can access as another user using its own credentials ### Details I feel we’ve a security issue that is due to the fact that we allow changing the user in the cases in which that’s already provided by PAM, I’ve not tested this using the entra-id broker but it’s reproducible with the example one, but unless I’m missing something it should be independent from the broker in use. Basically, by going to the user selection page we allow to login as any user by entering the use own credentials. See for example: https://asciinema.org/a/VIcjpDImomaGu0wxsJJxNdmlf or https://asciinema.org/a/CV3D1gaEhn2yclqSMKCnifYPo Basically it’s possible to logging in as `user1` using the credentials of `user2` or `user3`. The issue doesn’t affect login or passwd, but it does affect `su` and `sshd`, since in both cases they don’t check if the `PAM_USER` changed before the final authentication. Now, while those tools should likely be fixed to only read the PAM_USER once pam gave them the final ok, I think authd should not allow changing the user at all when it has been provided by PAM. </details>

CVE-2024-9313 Affected Github.com/ubuntu/authd Versions

2 component(s)
Fixed Versions:
0.0.0-20240930103526-63e527496b010.3.5
Product / Package Ecosystem Affected Versions Fixed Version
github.com/ubuntu/authd
Go
< 0.0.0-20240930103526-63e527496b01
0.0.0-20240930103526-63e527496b01
github.com/ubuntu/authd
Go
≥ 0.1.0
< 0.3.5
0.3.5

References

Frequently Asked Questions

What is CVE-2024-9313?
CVE-2024-9313 is a security vulnerability in Github.com/ubuntu/authd involving PAM module may allow accessing with the credentials of another user under CWE-287: Improper Authentication.
Which Github.com/ubuntu/authd versions are affected?
Affected versions include releases prior to 0.0.0-20240930103526-63e527496b01, 0.3.5 across affected packages: github.com/ubuntu/authd.
What version fixes CVE-2024-9313?
Upgrading to 0.0.0-20240930103526-63e527496b01, 0.3.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/ubuntu/authd affected?
Yes, github.com/ubuntu/authd is affected in releases prior to 0.0.0-20240930103526-63e527496b01, 0.3.5. Upgrade your dependency to 0.0.0-20240930103526-63e527496b01, 0.3.5 or later.
What is the CVSS score of CVE-2024-9313?
CVE-2024-9313 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-9313?
CVE-2024-9313 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 CVE-2024-9313?
Run the dependency tree command: 'inspect dependencies for github.com/ubuntu/authd'. 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-x5q3-c8rm-w787",
  "modified" : "2025-01-21T17:19:31Z",
  "published" : "2024-10-03T16:53:07Z",
  "aliases" : [ "CVE-2024-9313" ],
  "summary" : "PAM module may allow accessing with the credentials of another user",
  "details" : "Authd PAM module up to version 0.3.4 can allow broker-managed users to impersonate any other user managed by the same broker and perform any PAM operation with it, including authenticating as them.\n\nThis is possible using tools such as `su`, `sudo` or `ssh` (and potentially others) that, so far, do not ensure that the PAM user at the end of the transaction is matching the one who initiated the transaction.\n\nAuthd 0.3.5 fixes this by not allowing changing the user unless it was never set before in the PAM stack.\n\n`su` version that will include https://github.com/util-linux/util-linux/pull/3206 will not be affected\n`ssh` version that will include https://github.com/openssh/openssh-portable/pull/521 will not be affected\n`sudo` version that will include https://github.com/sudo-project/sudo/pull/412 will not be affected\n`login` not affected\n`passwd` not affected\n\n<details>\n<summary>Old report</summary>\n\n### Summary\n\nAn user can access as another user using its own credentials\n\n### Details\n\nI feel we’ve a security issue that is due to the fact that we allow changing the user in the cases in which that’s already provided by PAM, I’ve not tested this using the entra-id broker but it’s reproducible with the example one, but unless I’m missing something it should be independent from the broker in use.\n\nBasically, by going to the user selection page we allow to login as any user by entering the use own credentials.\n\nSee for example: https://asciinema.org/a/VIcjpDImomaGu0wxsJJxNdmlf or https://asciinema.org/a/CV3D1gaEhn2yclqSMKCnifYPo  \n\nBasically it’s possible to logging in as `user1` using the credentials of `user2` or `user3`.\n\nThe issue doesn’t affect login or passwd, but it does affect `su` and `sshd`, since in both cases they don’t check if the `PAM_USER` changed before the final authentication.\n\nNow, while those tools should likely be fixed to only read the PAM_USER once pam gave them the final ok, I think authd should not allow changing the user at all when it has been provided by PAM.\n</details>",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/ubuntu/authd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.0-20240930103526-63e527496b01"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/ubuntu/authd"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.1.0"
      }, {
        "fixed" : "0.3.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ubuntu/authd/security/advisories/GHSA-x5q3-c8rm-w787"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-9313"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ubuntu/authd/commit/63e527496b013bed46904c1c58be593c13ebdce5"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ubuntu/authd"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2024-3181"
  }, {
    "type" : "WEB",
    "url" : "https://www.cve.org/CVERecord?id=CVE-2024-9313"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-03T16:53:07Z",
    "nvd_published_at" : "2024-10-03T11:15:13Z"
  }
}