Skip to content
Access control Disclosed report Intermediate CVE-2022-0871

Gogs vulnerable to improper PAM authorization handling

Gogs installations using PAM for authentication treated expired PAM accounts and accounts with expired passwords as valid. An attacker with such an account could still log in despite the account being expired.

gogs/gogs

Originally disclosed on huntr

Impact

Expired PAM accounts and accounts with expired passwords are continued to be seen as valid. Installations use PAM as authentication sources are affected.

Patches

Expired PAM accounts and accounts with expired passwords are no longer being seen as valid. Users should upgrade to 0.12.5 or the latest 0.13.0+dev.

Workarounds

In addition to marking PAM accounts as expired, also disable/lock them. Running usermod -L <username> will add an exclamation mark to the password hash and would result in wrong passwords responses when trying to login.

References

https://huntr.dev/bounties/ea82cfc9-b55c-41fe-ae58-0d0e0bd7ab62/

For more information

If you have any questions or comments about this advisory, please post on https://github.com/gogs/gogs/issues/6810.

From the GitHub Advisory Database (GHSA-gw5h-h6hj-f56g, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

What the attacker needed

Gogs uses PAM for authentication; Attacker has a PAM account that is expired or has an…

The fix

The issue was fixed in version 0.12.5 and 0.13.0+dev by no longer treating expired PAM accounts or expired passwords as valid.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

PAM is a system on Linux that checks usernames and passwords. Normally, if an account is expired or its password has expired, PAM should reject the login. Here, Gogs ignored that and let the person in anyway.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More from gogs/gogs

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.