Skip to content
Access control Disclosed report Beginner CVE-2023-39963

New AppPassword can be generated without password confirmation

The password confirmation required to generate a new app password could be bypassed by calling a specific API endpoint, allowing an attacker with temporary access to an unlocked session to obtain an app password without re-entering the account password.

mikaelgundersen Follow

Originally disclosed on HackerOne

Bounty$250 High 8.1 View original
  • Triaged in 5 days
  • Fixed in 5 days
  • Paid in 47 days
  • Disclosed after 28 days

Summary by the program

Security advisory at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-j4qm-5q5x-54m5

The report

There is protection on https://github.com/nextcloud/server/blob/master/apps/settings/lib/Controller/AuthSettingsController.php#L122 that you must have recently entered your password to be able to generate a new AppPassword. However if an attacker would obtain access to your system (say you forgot to lock it when taking a quick bathroom break).

They can abuse a route to just obtain this. https://SERVER/ocs/v2.php/core/getapppassword Probably without you ever noticing.

Impact

The password confirmation to generate an app password is effectively useless as it is trivial to bypass.

The original report as published on HackerOne, by mikaelgundersen. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

What the report shows

The target is Nextcloud's server codebase, specifically the settings app's authentication settings controller. The feature in question is the generation of AppPasswords, the per-device credentials that Nextcloud users create for clients that cannot handle the normal login flow.

The report points to an existing protection in apps/settings/lib/Controller/AuthSettingsController.php (line 122 in the linked revision): before a new AppPassword can be generated, the user must have recently re-entered their account password. The researcher's observation is that this confirmation can be sidestepped. An attacker who already has access to a logged-in session, for example someone at an unlocked machine, can call a different route that hands back an app password directly:

HTTP
https://SERVER/ocs/v2.php/core/getapppassword

The report does not describe the request method, headers, authentication details or the response body, and it does not walk through a reproduction. The claim is simply that this OCS endpoint returns an app password without the password confirmation step, so the attacker obtains a credential without the legitimate user noticing.

The report's own impact statement is blunt: the password confirmation that is supposed to guard app password generation is effectively useless, because it is trivial to bypass. The platform records the issue as high severity with a CVSS score of 8.1, classified as improper access control, and a bounty of 250.00 USD was paid. The report was disclosed on 10 August 2023, and the program's summary links to the published security advisory GHSA-j4qm-5q5x-54m5. The report text itself does not describe the fix.

Root cause

The report does not state the root cause; it only shows that the settings controller enforces the check while the OCS route does not. The settings controller enforces the recent-password requirement, but the OCS core route that also produces an app password does not apply the same check. Any code path that can mint the same credential must enforce the same precondition; when the check is attached to a single entry point, every other entry point becomes a bypass.

Impact

The threat model here is an attacker with existing access to an authenticated session, not a remote unauthenticated attacker. The report's example is a user who leaves a machine unlocked. In that situation the attacker can obtain an app password without the password confirmation step. The report says the user would probably never notice. Because the confirmation prompt is meant to guard this step, its absence lets an attacker with session access obtain an app password.

How this kind of bug works

This is a missing-authorisation-check bug on an alternate code path. Applications often implement a sensitive operation in more than one place: a web UI controller, an API endpoint, a legacy route, a mobile-specific handler. A security control such as re-authentication, a CSRF token check or a role check gets added to the path that was under review at the time, and the other paths keep working because they were written earlier or by a different team.

The control itself is a step-up authentication requirement: the server records when the user last proved knowledge of their password and refuses the sensitive action if that proof is too old. It only works if every handler for the action consults that record. Defences that hold up are centralising the check in the service layer that performs the operation, applying it as middleware or a policy on the route group, and testing each route that reaches the operation, including OCS and API namespaces that are easy to overlook.

How to test for it

  1. Identify a sensitive action that is protected by a precondition in the UI, such as re-entering a password, solving a CAPTCHA, confirming an email address or holding a privileged role. Note the exact request the UI sends when the precondition is satisfied.
  2. Enumerate every other route that performs the same action. Look at API and OCS namespaces, versioned endpoints, mobile and desktop client traffic, and older routes kept for compatibility. Client source code and API documentation are good sources.
  3. From a session that has not satisfied the precondition, send the equivalent request to each alternate route. A positive result is a successful response that creates or returns the protected object, for example a new credential, without any confirmation step.
  4. Confirm the result is real: use the returned credential or observe the new object in the account, and check that the normal UI path would have demanded confirmation at that moment.

Common false positives: the session may still be inside the freshness window from an earlier confirmation, so wait until it expires or start from a fresh login; a cached response or a client-side prompt may make the server look unprotected when it is not; and some endpoints legitimately return an existing credential rather than creating a new one, which is a different behaviour from bypassing the check. Verify what was actually created and when.

The report does not describe the fix. Where a route must remain, add the same freshness check to it explicitly. Add regression tests that call each route without a recent confirmation and expect a refusal, and review the route table whenever a new sensitive action is introduced.

Hunting notes

These bugs cluster around features with more than one front door: credential and token management, password and email changes, MFA enrolment and disabling, data export, and anything a mobile client calls. Recon signals include an OCS or API namespace that mirrors UI functionality, client applications that talk to endpoints the web UI never uses, and changelogs mentioning new API routes for an old feature. To make the report land, show the precondition being enforced on one path and absent on the other, demonstrate the concrete artefact created (a working credential, a changed setting), and state the attacker position honestly: session access is a real threat model, but describing it accurately is what gets the severity accepted.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What happened, in plain words

Nextcloud is a self-hosted file sync and sharing platform: you run it on your own server and reach it through a browser or a desktop and mobile client. One of its features is the AppPassword. An AppPassword is a separate password created for one device or one app, so that a client which cannot handle the normal browser login can still sign in. It is a separate credential created for a device or app.

Because an AppPassword is powerful, Nextcloud puts a guard in front of creating one. Before the server hands out a new AppPassword, the user must have recently typed their account password again. The user must have recently entered their account password before a new AppPassword can be generated. The check requires the user to have recently entered their password before generating a new AppPassword.

The report points at that guard in the settings app, in the file apps/settings/lib/Controller/AuthSettingsController.php (line 122 in the linked revision). The researcher's finding is that the guard can be skipped. An attacker who already has access to a logged-in session, for example someone at a machine you left unlocked while you stepped away, can call a different route that returns an app password directly:

HTTP
https://SERVER/ocs/v2.php/core/getapppassword

Line by line, this is a single URL and nothing more:

  • https:// is the ordinary secure web protocol; the request travels encrypted.
  • SERVER stands for the hostname of the Nextcloud installation. The report uses a placeholder rather than a real address.
  • /ocs/v2.php is the OCS namespace, Nextcloud's API layer. An API (application programming interface) is a set of URLs meant for programs rather than for people clicking buttons; the web interface and the mobile apps both talk to the server this way. v2 is the version of that interface.
  • /core/getapppassword is the route itself, whose name says what it does: get an app password.

The point of the bypass is that this route produces the same kind of credential as the guarded settings screen, but without asking for the password confirmation first. The report does not describe the request method, headers, authentication details or the response body, and it does not walk through a reproduction. The claim is simply that this endpoint returns an app password without the confirmation step.

Why does that matter? The confirmation prompt is the one moment where the person at the keyboard has to prove they are the account owner. Remove it, and an attacker at an unlocked computer can obtain an app password without the confirmation step. The report says the user would probably never notice.

The report's own impact statement is blunt: the password confirmation meant to guard app password generation is effectively useless, because it is trivial to bypass. The platform records the issue as high severity with a CVSS score of 8.1, classified as improper access control, and a bounty of 250.00 USD was paid. It was disclosed on 10 August 2023, and the program's summary links to the published security advisory GHSA-j4qm-5q5x-54m5. The report text does not describe the fix.

In general, how this kind of bug works

This is a missing authorisation check on an alternate code path. Authorisation means deciding whether the person making a request is allowed to do the thing they are asking for. A code path is simply one route through the program that reaches a given operation.

Applications often implement a sensitive operation in more than one place: a web page controller, an API endpoint, an older route kept for compatibility, a handler written for mobile clients. A security control such as re-authentication, a CSRF token check (a token that proves a form came from the site itself) or a role check gets added to the path that was under review at the time, and the other paths keep working because they were written earlier or by a different team. Think of a building with a guarded front door and a side entrance nobody remembered to lock.

A step-up check only works if every handler for the action consults the record of when the password was last confirmed. Defences that hold up centralise the check in the shared code that performs the operation, apply it as middleware (code that runs on every request before the handler) or as a policy on a group of routes, and test each route that reaches the operation, including API and OCS namespaces that are easy to overlook.

How to test for it

  1. Identify a sensitive action that is protected by a precondition in the interface, such as re-entering a password, solving a CAPTCHA, confirming an email address or holding a privileged role. Note the exact request the interface sends when the precondition is satisfied.
  2. Enumerate every other route that performs the same action. Look at API and OCS namespaces, versioned endpoints, mobile and desktop client traffic, and older routes kept for compatibility. Client source code and API documentation are good sources.
  3. From a session that has not satisfied the precondition, send the equivalent request to each alternate route. A positive result is a successful response that creates or returns the protected object, for example a new credential, without any confirmation step.
  4. Confirm the result is real: use the returned credential or observe the new object in the account, and check that the normal interface path would have demanded confirmation at that moment.

Common false positives: the session may still be inside the freshness window from an earlier confirmation, so wait until it expires or start from a fresh login; a cached response or a client-side prompt may make the server look unprotected when it is not; and some endpoints legitimately return an existing credential rather than creating a new one, which is a different behaviour from bypassing the check. Verify what was actually created and when.

The report does not describe the fix. Where a route must remain, add the same freshness check to it explicitly. Add regression tests that call each route without a recent confirmation and expect a refusal, and review the route table whenever a new sensitive action is introduced.

Hunting notes

These bugs cluster around features with more than one front door: credential and token management, password and email changes, MFA enrolment and disabling, data export, and anything a mobile client calls. Recon signals include an OCS or API namespace that mirrors interface functionality, client applications that talk to endpoints the web interface never uses, and changelogs mentioning new API routes for an old feature. To make the report land, show the precondition being enforced on one path and absent on the other, demonstrate the concrete artefact created (a working credential, a changed setting), and state the attacker position honestly: session access is a real threat model, but describing it accurately is what gets the severity accepted.

Glossary

  • Nextcloud: a self-hosted platform for storing and sharing files, reached through a browser or client apps.
  • AppPassword: a separate password created for one device or app, which keeps working after the browser session ends.
  • Credential: any secret used to prove identity, such as a password or token.
  • Session: the state that keeps you logged in after you sign in, usually held in a cookie.
  • Cookie: a small piece of data the browser stores for a site and sends back with each request.
  • Token: a string that stands in for a password when a program authenticates.
  • Route / endpoint: a URL that the server answers with a specific action.
  • API: a set of URLs meant for programs rather than people clicking buttons.
  • OCS: Nextcloud's API layer, reached under /ocs/.
  • Controller: the part of the code that handles a request to a route.
  • Step-up authentication: asking the user to prove their identity again before a sensitive action.
  • Authorisation: deciding whether a request is allowed to perform the action it asks for.
  • Improper access control: a vulnerability class where a check on who may do what is missing or wrong.
  • CSRF token: a value in a form that proves the request came from the site itself, not another site.
  • Middleware: code that runs on every request before the handler.
  • CVSS: a standard scoring system for the severity of a vulnerability.
  • Bounty: a payment made to a researcher who reports a valid vulnerability.
  • Threat model: a description of who the attacker is and what access they already have.
  • False positive: a finding that looks like a vulnerability but is not one.

More by mikaelgundersen

View all

6 more disclosed reports, best first.

More from Nextcloud

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.