Skip to content
IDOR Write-up Intermediate

I Thought I Found a Critical IDOR. I Was Wrong.

The author reviewed the source code of a WireGuard management portal and believed the older API version lacked an ownership check when retrieving peer objects, which contained private keys. After the triager pointed out that the check was enforced lower in the call chain, the author confirmed the authorisation was present and the report was closed as Not Applicable.

medium.com

Published on medium.com

Cybersecurity

Lh1l0v3, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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. 5 min read.

Context

A WireGuard management portal, part of an Intigriti program, exposes peer objects through several API versions. A peer is the unit the portal manages: it carries the WireGuard configuration, and that configuration contains the peer's private key, the credential the peer uses to authenticate to the VPN. The report mentions endpoints for modifying and deleting peers.

The researcher had been shifting towards source code review rather than only sending requests through Burp, and he reviewed this application from the source. The question being asked of the code was how the application decided whether a user was allowed to access another peer.

Setup

The report does not describe accounts, roles, tooling versions or any other precondition. No requests, responses or live traffic are shown anywhere in the write-up; the whole investigation is a reading of the code.

Finding it

The starting point was a comparison between API versions. In the newer version, the peer handling code retrieves the peer and then explicitly checks whether the current user is allowed to access it. The code looked roughly like this:

Text
peer, err := s.peers.GetPeer(ctx, id)if err != nil {    return nil, err}if err := domain.ValidateUserAccessRights(ctx, peer.UserIdentifier); err != nil {    return nil, err}return peer, nil

The peer is fetched by identifier, and domain.ValidateUserAccessRights(ctx, peer.UserIdentifier) is then called with the peer's owner identifier before the object is returned. That is the expected shape: retrieve, then authorise.

The older API implementation looked different:

Text
func (p PeerService) GetPeer(ctx context.Context, id domain.PeerIdentifier) (*domain.Peer, error) {    return p.peers.GetPeer(ctx, id)}

There is no ValidateUserAccessRights() in this service method. The identifier is accepted and passed straight down to the underlying store. The same pattern appeared in the method responsible for retrieving a peer's configuration.

To the researcher this looked like classic broken object-level authorization: the API accepts a peer identifier, passes it down to retrieve the object, and no ownership check is visible in the service layer. Looking at what the peer configuration actually contains raised the stakes: the peer model holds the WireGuard private key. Retrieving another user's peer configuration would therefore not be a matter of viewing somebody else's data, but of obtaining the credentials that peer uses to authenticate to the VPN. The existence of endpoints for modifying and deleting peers widened the potential impact further.

The reasoning then asked whether, given another user's peer ID, the configuration could be requested, the private key extracted, and the VPN joined as that user.

The code paths were documented, the possible impact explained, and the report submitted to Intigriti as a Critical vulnerability.

Exploitation

There is no exploitation to show. The triager's response was that only one part of the application had been reviewed.

Step 1: the layer that was reviewed

The peer service was not the final place where the authorization decision was made. Its methods delegated the actual operation to another component, and the underlying implementation in wireguard_peers.go contained the authorization checks. The review had covered only this much of the flow:

Text
API handler    ↓Peer service

Step 2: the flow that actually runs

The real call chain continues past the service into a peer manager, and the authorization check lives there:

Text
API handler    ↓Peer service    ↓Peer manager    ↓Authorization check

Step 3: verifying the call chain

Following the chain properly in the repository showed that the underlying peer implementation does enforce ValidateUserAccessRights() for the relevant operations. The configuration path that had been considered vulnerable was traced as well, and it eventually reaches the configuration manager, where the authorization check is also enforced.

The conclusion drawn from the API service layer was therefore wrong. The application does not retrieve another user's peer without checking ownership; the check exists, lower in the call chain than where the review had stopped.

Step 4: closing the report

The researcher replied to the triager confirming that the implementation had been followed deeper and that the authorization check was present in the actual call path, and acknowledged having initially missed the separate configuration manager. The report was closed as Not Applicable, with no bounty.

Root cause

The mistake was in the review, not in the application. A missing check in a service method was treated as evidence that the operation itself lacked authorization, when those are two different things. The older API delegates the operation to a component that performs the check itself, while the newer API performs it in the service layer. Both enforce the boundary; they enforce it in different layers.

The comparison between versions was a useful clue but also a trap: assuming that both versions enforce security in exactly the same layer makes a delegated check look like an absent one. The question that matters is not whether a particular function contains an authorization check, but whether an unauthorised request can reach the sensitive operation without being stopped.

Impact

None in practice. The authorization boundary was enforced on the paths examined, so the retrieval of another user's peer configuration, private key included, was not possible there. The hypothetical impact described in the original report, VPN access as another user via a stolen private key, depended entirely on the missing check being real, and it was not.

Fix

The report was closed as Not Applicable. The report was closed as Not Applicable.

Variants to test

These are habits for source review of authorization, drawn from what went wrong here.

  1. Follow the call chain to the sink. Start at the handler and keep going through every delegation until the object is actually read, written or deleted. A positive result is a path from an attacker-controlled identifier to the sensitive operation with no ownership check anywhere along it.
  2. Check every layer that can terminate the request. Middleware, decorators, policy engines and manager-level guards can all enforce authorization. A positive result is a request that reaches the sink despite failing the check at every layer that exists.
  3. Compare API versions by behaviour, not by location. When a newer version checks in the service and an older one delegates, verify where the older one checks rather than assuming it does not. A positive result is an older endpoint that returns another user's object when called with a foreign identifier.
  4. Trace secondary paths to the same object. Configuration retrieval, export, download and modification endpoints often reach the object through a different manager than the plain read. A positive result is any of those paths returning or altering a foreign object. A positive result is the foreign object's contents, here a private key, in the response.

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. 16 min read.

What happened, in plain words

A security researcher was looking at the source code of a web application. Source code is the set of instructions that programmers write to build a website or an app; normally you only see the finished website in your browser, but if the code is available to you, you can read how the site works from the inside. The researcher had started doing this more often instead of only clicking around a site and watching what the browser sends and receives.

The application in question was a management portal for WireGuard. WireGuard is a piece of software that creates a VPN, which is a private, encrypted tunnel between your computer and a network, so that your traffic travels safely even over the open internet. A portal is a website where an administrator or a user manages something; here, it manages the VPN connections. The portal was part of a bug bounty program run by Intigriti. A bug bounty program is a scheme where companies invite outside researchers to look for security problems in their systems and report them, sometimes for a reward called a bounty.

The researcher thought they had found a serious flaw: a way for one logged-in user to read another user's VPN configuration, including the secret key that lets that user connect to the VPN. They wrote it up and submitted it as a Critical vulnerability, the highest severity level. Then a triager, the person at the program who reviews incoming reports, replied that the researcher had only looked at one part of the application. The real permission check was made further down, in a different piece of code. The researcher went back, followed the trail properly, and confirmed the check was there all along. The report was closed as Not Applicable, which means the program decided there was nothing to fix, and no bounty was paid.

This article walks through the whole story slowly, explaining each idea as it appears, because the lesson is not really about WireGuard or about this particular portal. It is about how to read code when you are hunting for permission problems, and about a mistake that is very easy to make.

The context: what the portal manages

The portal exposes something called peer objects through several versions of its API. Let us unpack that.

An API (Application Programming Interface) is the set of doors and windows through which one piece of software talks to another. When you use a website, your browser sends requests to the site's API and the API sends back data. Think of a restaurant: the menu and the waiter are the API. You do not walk into the kitchen yourself; you ask the waiter for a dish, and the waiter brings it. In the same way, a web page asks the API for data, and the API fetches it from the kitchen, which is the database and the rest of the server-side software.

A peer is the unit this portal manages. In WireGuard, a peer is one participant in the VPN: a laptop, a phone, a server, each with its own configuration. The configuration is the set of settings and secrets that peer needs in order to join the VPN. Crucially, that configuration contains the peer's private key. A private key is a long secret string of characters, like a password that is never shown to anyone else. In WireGuard, the private key is the credential the peer uses to prove who it is when it connects to the VPN. If someone else gets your private key, they can pretend to be your peer and connect to the VPN as you.

The report mentions endpoints for modifying and deleting peers. An endpoint is a specific address on a server that does one job, for example "give me the details of peer number 42" or "delete peer number 42". You can think of endpoints as the individual counters at a train station: each one sells a particular ticket.

The researcher had been moving towards reading source code rather than only sending requests through Burp. Burp (Burp Suite) is a tool that sits between your browser and a website and lets you watch, pause and change the requests going back and forth. It is very useful, but it only shows you the outside of the application. Reading the source code shows you the inside. The question the researcher was asking of the code was simple to state: how does this application decide whether a user is allowed to access another user's peer?

The setup

The report does not describe accounts, roles, tooling versions or any other precondition. No requests, responses or live traffic are shown anywhere in the write-up; the whole investigation is a reading of the code. That is worth keeping in mind: there is no attack to replay here, only a chain of reasoning about what the code does.

Finding it

The starting point was a comparison between two versions of the API. Applications often keep an older version of their API running while a newer one is introduced, so that older clients do not break. Comparing the two can be a good way to spot changes in how security is handled, because developers sometimes fix a problem in the new version and forget the old one.

In the newer version, the code that handles peers retrieves the peer and then explicitly checks whether the current user is allowed to access it. The code looked roughly like this:

Text
peer, err := s.peers.GetPeer(ctx, id)if err != nil {    return nil, err}if err := domain.ValidateUserAccessRights(ctx, peer.UserIdentifier); err != nil {    return nil, err}return peer, nil

Line by line, in plain words:

  1. peer, err := s.peers.GetPeer(ctx, id) asks the underlying storage for the peer whose identifier is id, and stores the result in a variable called peer and any error in a variable called err. The ctx is a context, a small package of information that travels with the request, such as who is asking. The := means "create these variables and assign these values".
  2. if err != nil { checks whether something went wrong. nil means "nothing", so err != nil means "there is an error".
  3. return nil, err stops and passes the error back up to whoever called this function.
  4. if err := domain.ValidateUserAccessRights(ctx, peer.UserIdentifier); err != nil { is the important line. It calls a function named ValidateUserAccessRights, which literally means "check that this user has the right to access this thing". It passes the context and the peer's owner identifier, peer.UserIdentifier, which says who the peer belongs to. If that check fails, the next line runs.
  5. return nil, err again stops and returns the error, so the peer is never handed back.
  6. return peer, nil is reached only if the peer was found and the permission check passed. It returns the peer and no error.

That is the expected shape of safe code: retrieve the object, then authorise the person asking, then return it. Authorise here simply means "check that this person is allowed".

The older API implementation looked different:

Text
func (p PeerService) GetPeer(ctx context.Context, id domain.PeerIdentifier) (*domain.Peer, error) {    return p.peers.GetPeer(ctx, id)}

Line by line:

  1. func (p PeerService) GetPeer(...) declares a function called GetPeer that belongs to a type called PeerService. The p is just a name for the particular PeerService the function is working on, like saying "this service".
  2. ctx context.Context, id domain.PeerIdentifier are the inputs: the context and the peer identifier. The identifier is of a special type called domain.PeerIdentifier, which is just a way of saying "this string is meant to be a peer ID".
  3. (*domain.Peer, error) is what the function gives back: either a peer or an error.
  4. return p.peers.GetPeer(ctx, id) is the entire body. It takes the identifier and passes it straight down to p.peers, the underlying store, and returns whatever comes back.

There is no ValidateUserAccessRights() anywhere in this service method. The identifier is accepted and passed straight down. The same pattern appeared in the method responsible for retrieving a peer's configuration.

To the researcher this looked like classic broken object-level authorization. Broken object-level authorization, often shortened to IDOR (Insecure Direct Object Reference), is a vulnerability where an application lets you ask for an object by its identifier without checking that the object is yours. A simple everyday comparison: imagine a hotel where room keys are numbered, and the reception hands you key number 12 for your room. If the hotel's system lets you ask for key number 13 and simply gives it to you because you asked, that is an IDOR. The application trusts the number you supply instead of checking that the room is booked in your name. In web terms, if a site has an endpoint like /invoice?id=1001 and changing the number to 1002 shows you someone else's invoice, that is the same mistake.

Looking at what the peer configuration actually contains raised the stakes. The peer model holds the WireGuard private key. A model here means the program's internal representation of a thing: the list of fields that make up a peer, such as its name, its address and its keys. Retrieving another user's peer configuration would therefore not be a matter of viewing somebody else's data, but of obtaining the credentials that peer uses to authenticate to the VPN. The existence of endpoints for modifying and deleting peers widened the potential impact further: an attacker might not only read but also change or destroy someone else's VPN setup.

The reasoning then followed the attack from that perspective, step by step:

  1. Obtain another user's peer ID.
  2. Request that peer's configuration through the older API endpoint.
  3. Extract the private key from the response.
  4. Use the private key to connect to the VPN as that user.

The code paths were documented, the possible impact explained, and the report submitted to Intigriti as a Critical vulnerability. Documenting the code paths means writing down exactly which functions the request passes through, so that the reviewer can follow the same trail.

Exploitation

There is no exploitation to show. Exploitation means actually carrying out the attack against a live system to prove it works, as opposed to only suspecting it from reading code. The triager's response was that only one part of the application had been reviewed.

Step 1: the layer that was reviewed

The peer service was not the final place where the authorization decision was made. Its methods delegated the actual operation to another component, and the underlying implementation in wireguard_peers.go contained the authorization checks. To delegate means to hand a task to someone else: the service method does not do the work itself, it asks another part of the program to do it. wireguard_peers.go is simply the name of a source file, and the .go ending tells you it is written in the Go programming language.

The review had covered only this much of the flow:

Text
API handler    ↓Peer service

This little diagram is a map. The API handler is the first piece of code that receives an incoming request, like the receptionist at a company. The arrow pointing down means "then it calls". So the map says: the request arrives at the handler, the handler calls the peer service, and that is where the researcher stopped reading. It looked as if the receptionist forwarded the request to a clerk who did not check any paperwork.

Step 2: the flow that actually runs

The real call chain continues past the service into a peer manager, and the authorization check lives there:

Text
API handler    ↓Peer service    ↓Peer manager    ↓Authorization check

A call chain is the sequence of functions that call one another while handling a single request, like a chain of people passing a message along. This second map shows the full chain: the handler calls the service, the service calls the peer manager, and the peer manager performs the authorization check. The clerk in our comparison did not do the paperwork check personally, but they passed the request to a supervisor who did. Reading only the clerk's desk made it look as though nobody checked.

Step 3: verifying the call chain

Following the chain properly in the repository showed that the underlying peer implementation does enforce ValidateUserAccessRights() for the relevant operations. A repository is the place where source code is stored and managed, a bit like a shared folder with a history of every change. To enforce a check means to actually carry it out, not just to have it written somewhere.

The configuration path that had been considered vulnerable was traced as well, and it eventually reaches the configuration manager, where the authorization check is also enforced. A path here means the route a request takes through the code, function by function. The configuration manager is another component, separate from the peer manager, that handles configuration requests; the researcher had missed it on the first pass.

The conclusion drawn from the API service layer was therefore wrong. The application does not retrieve another user's peer without checking ownership; the check exists, lower in the call chain than where the review had stopped.

Step 4: closing the report

The researcher replied to the triager confirming that the implementation had been followed deeper and that the authorization check was present in the actual call path, and acknowledged having initially missed the separate configuration manager. The report was closed as Not Applicable, with no bounty. Not Applicable is a status meaning the program has decided the report does not describe a real vulnerability that needs fixing.

Root cause

The mistake was in the review, not in the application. A missing check in a service method was treated as evidence that the operation itself lacked authorization, when those are two different things. The older API delegates the operation to a component that performs the check itself, while the newer API performs it in the service layer. Both enforce the boundary; they enforce it in different layers.

A security boundary is the line in a system where a decision is made about who is allowed to do what. It does not matter whether that line is drawn at the front desk or in the back office, as long as it is drawn somewhere that every request must cross.

The comparison between versions was a useful clue but also a trap: assuming that both versions enforce security in exactly the same layer makes a delegated check look like an absent one. The question that matters is not whether a particular function contains an authorization check, but whether an unauthorised request can reach the sensitive operation without being stopped.

Impact

None in practice. The authorization boundary was enforced on the paths examined, so the retrieval of another user's peer configuration, private key included, was not possible there. Authenticated means logged in: the user has proved who they are, for example with a username and password. The hypothetical impact described in the original report, VPN access as another user via a stolen private key, depended entirely on the missing check being real, and it was not.

Fix

The report was closed as Not Applicable. The report was closed as Not Applicable.

Variants to test

These are habits for source review of authorization, drawn from what went wrong here. They are written for someone who is learning to read code with security in mind.

  1. Follow the call chain to the sink. Start at the handler and keep going through every delegation until the object is actually read, written or deleted. The sink is the place where the sensitive action finally happens, such as reading the private key out of storage. A positive result is a path from an attacker-controlled identifier to the sensitive operation with no ownership check anywhere along it.
  2. Check every layer that can terminate the request. Middleware, decorators, policy engines and manager-level guards can all enforce authorization. Middleware is code that runs on every request before it reaches the main handler, like a security guard at the building entrance. A decorator is a wrapper that adds behaviour around a function without changing the function itself. A policy engine is a component whose whole job is to answer "is this allowed?". A guard is any check that can stop a request. A positive result is a request that reaches the sink despite failing the check at every layer that exists.
  3. Compare API versions by behaviour, not by location. When a newer version checks in the service and an older one delegates, verify where the older one checks rather than assuming it does not. A positive result is an older endpoint that returns another user's object when called with a foreign identifier.
  4. Trace secondary paths to the same object. Configuration retrieval, export, download and modification endpoints often reach the object through a different manager than the plain read. A positive result is any of those paths returning or altering a foreign object. A positive result is the foreign object's contents, here a private key, in the response. Two accounts are needed because you must be logged in as one user while asking for the other user's object; that is the only way to tell whether the application stops you.

Glossary

  • API: the set of addresses and rules through which one piece of software asks another for data or actions; the waiter between your browser and the server's kitchen.
  • API handler: the first piece of code that receives an incoming request and decides what to do with it.
  • Authenticated: logged in, having proved your identity to the application.
  • Authorization: the decision about whether a particular user is allowed to perform a particular action on a particular object.
  • Bounty: a reward, usually money, paid by a bug bounty program for a valid security report.
  • Broken object-level authorization (IDOR): a flaw where an application lets you access an object by its identifier without checking that the object belongs to you.
  • Bug bounty program: a scheme where organisations invite outside researchers to report security problems, often for a reward.
  • Burp (Burp Suite): a tool that sits between your browser and a website so you can watch, pause and modify requests.
  • Call chain: the sequence of functions that call one another while a single request is being handled.
  • Configuration manager: the component in this application that handles requests for peer configurations and enforces the authorization check for them.
  • Context (ctx): a small package of information that travels with a request through the code, such as who is asking.
  • Critical: the highest severity rating for a vulnerability, meaning it could cause very serious harm if exploited.
  • Decorator: a wrapper around a function that adds behaviour, such as a permission check, without changing the function itself.
  • Delegation: handing a task to another part of the program instead of doing it yourself.
  • Endpoint: a specific address on a server that performs one job, such as returning or deleting a particular peer.
  • Enforce: to actually carry out a check, not merely to have it written down somewhere.
  • Exploitation: actually carrying out an attack against a live system to prove that a suspected flaw is real.
  • Go: a programming language; source files written in it end in .go.
  • Guard: any check in the code that can stop a request from continuing.
  • Intigriti: the bug bounty platform that ran the program this report was submitted to.
  • Middleware: code that runs on every request before it reaches the main handler, like a guard at a building entrance.
  • Model: the program's internal representation of a thing, listing the fields that make it up.
  • Path: the route a request takes through the code, function by function.
  • Peer: one participant in a WireGuard VPN, such as a laptop or phone, together with its configuration.
  • Peer manager: the component that performs the actual peer operations and, in this application, the authorization check.
  • Peer service: the component that receives peer requests from the handler and delegates the work to the peer manager.
  • Policy engine: a component whose job is to answer whether a given action is allowed.
  • Portal: a website where users manage something, here VPN peers.
  • Private key: a long secret string that a peer uses to prove its identity when connecting to the VPN; anyone who has it can act as that peer.
  • Repository: the place where source code is stored and managed, including its history of changes.
  • Security boundary: the line in a system where the decision about who may do what is made; it matters that it exists and that every request crosses it, not where it sits.
  • Sink: the place in the code where the sensitive action finally happens, such as reading a private key from storage.
  • Source code: the instructions programmers write to build an application, readable by humans.
  • Triager: the person at a bug bounty program who reviews incoming reports and decides whether they are valid.
  • VPN: a private, encrypted tunnel between a computer and a network, so traffic travels safely over the open internet.
  • WireGuard: software that creates VPN connections, where each participant is a peer with its own configuration and keys.

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.