Skip to content
Access control Write-up Intermediate

Exploiting Arbitrary Object Instantiations in PHP without Custom Classes

The sign-up request accepted a role parameter, so a user could register themselves as admin and then as super admin. The same request also exposed other identifiers that allowed changing other users' data, including email and password, leading to account takeover.

Muhammad Talha Follow

Published on medium.com

The original lives on medium.com

We do not hold its text, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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 researcher, writing as Muhammad Talha (evilmango), describes an engagement against an application he calls example.com. The feature in scope was registration: there was no sign-up with an email address or phone number, and the only way in was an invite code issued by the site owners or administrators.

From the original on medium.com

His first observation was that the application applied no rate limiting to the invite code check. The code was six digits, so he decided to brute force it. He took a six-digit wordlist from his SecLists folder and ran it through Burp Suite's Turbo Intruder. According to the report the run took under ten minutes and returned between 20 and 30 valid invite codes.

From the original on medium.com

With a code in hand he registered an account and logged in. He then tried a range of things without success. In one response he noticed the field isAdmin=false, and set about trying to flip it: adding his own parameter, altering the server's response, and changing the value of the admin flag in the request. None of it worked.

From the original on medium.com

He captured all requests in Burp and analysed them for a couple of hours without finding anything. After a break he realised the one set of requests he had not revisited since logging in was the sign-up flow itself.

From the original on medium.com

Returning to registration, he noticed that the request did not carry an invite code at all. The practical consequence he notes is that a single invite code lets a user register as many accounts as they like, though he says explicitly that this is not his main finding.

From the original on medium.com

Instead he changed the role in the registration request to admin, and the application accepted it. The response then contained isSuperAdmin, a field he had not seen before, which led him to try the same trick again.

From the original on medium.com

Changing the role to superAdmin also succeeded. From there he states that further analysis of the requests revealed more IDORs: one that leads to takeover of all user accounts, and another that allows changing users' data and then taking over the account, because the email and password were present in the request fields.

From the original on medium.com

The report gives no bounty amount, no severity rating, no CVSS score and no confirmation that the issues were fixed. It also does not reproduce the actual registration request, so the parameter names and values used for the role change are not shown.

Root cause

The report does not state a root cause. A plausible explanation is mass assignment, also called autobinding: the registration handler may bind fields from the request body directly onto the user object it creates, including the role and super-admin fields. The server trusts client-supplied values for privilege attributes instead of deriving them from server-side policy. The report notes that the sign-up request was the one place he had not revisited since logging in.

Impact

As described, a person holding a single invite code could create an account with administrative and then super-administrative privileges. The researcher further reports IDORs reachable from the same area that lead to takeover of all user accounts and to modification of other users' data, with email and password exposed in request fields. These are his claims; the report does not include the requests or responses that demonstrate them.

How this kind of bug works

Many frameworks make it convenient to populate an object from a request: a JSON body or form post is mapped onto model properties by name. If the model contains sensitive properties such as role, isAdmin, isSuperAdmin, verified, balance or ownerId, and the mapping is not restricted to an allowlist, the client decides their values. The same pattern appears in profile update, password reset, invitation and organisation-membership endpoints, not only registration.

A related weakness shown here is a weak, guessable secret used to gate registration, with no rate limiting on the check. A six-digit code has a million possibilities, which is trivial to enumerate when nothing limits request volume.

Defences are an explicit allowlist of assignable fields, server-side derivation of every privilege attribute, and rate limiting plus lockout on any code or token verification.

How to test for it

  1. Map every endpoint that creates or updates an object tied to your account: registration, profile edit, settings, invitations, team membership, password change.
  2. Capture the legitimate request and note every field the client sends.
  3. Add fields that exist in the model but are not normally sent, using names suggested by responses and error messages: role, isAdmin, isSuperAdmin, permissions, verified, status, owner, tenant.
  4. Send the modified request and inspect the response and the resulting account state, for example by reloading the profile or calling an endpoint that only privileged users can reach.
  5. Try type juggling on existing fields as well: booleans as strings, arrays where a scalar is expected, and numeric IDs belonging to another account.
  6. For invite or reset codes, test whether verification is rate limited and whether the code space is small enough to enumerate.

A positive result is a response or subsequent state change that reflects the injected value, such as an admin-only page loading or a role field returning the value you sent. Common false positives are echoed values that are stored but never used for authorisation, and fields that are silently dropped by the framework; always confirm the privilege actually works by exercising a privileged action.

How it is fixed

Bind request data only to an explicit allowlist of fields. Never accept role, permission or ownership attributes from the client; set them from server-side logic at creation and change them only through dedicated, authorised endpoints. Apply the same rule to nested objects. Add rate limiting and lockout to invite code and token verification, and make codes long and random. For the IDOR side, enforce object-level authorisation on every read and write, checking that the authenticated principal owns or may access the referenced object, and avoid returning sensitive fields such as email and password in editable request or response bodies.

Hunting notes

Mass assignment hides wherever a framework auto-binds input: registration, profile updates, admin panels, API endpoints that accept JSON, and GraphQL mutations. Recon signals include verbose responses that list model fields, error messages naming unexpected properties, and JavaScript that references fields the UI never sends. Compare responses before and after adding a field; a new field appearing in the response is a strong hint that the model accepted it. To make a report land, demonstrate the privilege escalation end to end with a privileged action, keep the request and response pairs, and state clearly what an attacker gains. Weak invite or reset codes are worth reporting alongside, with evidence of the request volume achieved and the number of valid codes recovered.

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

What happened, in plain words

This is a story about a website where you could not simply sign up with an email address or a phone number. The only way to create an account was to enter an invite code, a short secret handed out by the site's owners or administrators. The researcher, Muhammad Talha (evilmango), was testing that registration feature.

From the original on medium.com

His first observation was that the site did not limit how many times someone could try an invite code. In everyday terms, imagine a door with a six-digit combination lock that never slows you down or locks you out after wrong guesses. A six-digit code has a million possible values, and a computer can try them quickly. He took a list of six-digit numbers from his SecLists folder (a well-known collection of wordlists used for this kind of guessing) and ran it through Turbo Intruder, a tool inside Burp Suite that fires many requests at once. According to the report the run took under ten minutes and produced between 20 and 30 valid invite codes.

From the original on medium.com

With a working code he registered an account and logged in. He then tried many things without success. In one response he saw the field isAdmin=false, which indicates whether the logged-in user is an administrator. Naturally he wanted to make it true. He tried adding his own parameter, changing the server's response, and changing the value of the admin flag in the request. None of it worked.

From the original on medium.com

He captured all the traffic in Burp (a tool that sits between your browser and the website and lets you read and edit every request) and studied it for a couple of hours without finding anything. After a break, he realised which requests he had never gone back to since logging in: the sign-up requests themselves.

From the original on medium.com

Back at registration, he noticed something odd: the request did not contain an invite code at all. The practical result is that one invite code lets a person create as many accounts as they like. He says clearly that this is not his main finding, though.

From the original on medium.com

Instead, he changed the role in the registration request to admin, and the site accepted it. The response then contained a field called isSuperAdmin, which he had not seen before. That suggested an even higher level of privilege existed.

From the original on medium.com

Changing the role to superAdmin also worked. From there he says that further study of the requests revealed more IDORs (Insecure Direct Object References, where a request refers to a record by an identifier and the server does not check that you are allowed to touch that record). One led to takeover of all user accounts, and another allowed changing users' data and then taking over the account, because the email and password were present in the request fields.

The report gives no bounty amount, no severity rating, no CVSS score and no confirmation that the issues were fixed. It also does not reproduce the actual registration request, so the exact parameter names and values used for the role change are not shown.

In general, how this kind of bug works

Many web frameworks make life easy for developers: when a form or a JSON body arrives, the framework copies each field onto an object in the code by matching names. If that object has sensitive properties such as role, isAdmin, isSuperAdmin, verified, balance or ownerId, and the copying is not restricted to a list of allowed fields, then the person sending the request decides their values. This is called mass assignment, or autobinding. The everyday comparison is a hotel check-in form where the guest is allowed to fill in their name, but the same form also has a hidden line for "room rate" and the clerk copies whatever the guest wrote there.

The same pattern shows up in profile updates, password resets, invitations and team membership, not only registration.

A second weakness here is a short, guessable secret used to gate registration, with no rate limiting on the check. A six-digit code has a million possibilities, which is nothing for a script when nothing limits how fast you can ask.

The defences are an explicit list of fields that may be set from a request, every privilege attribute decided on the server, and rate limiting plus lockout on any code or token check.

In general, how to test for it

  1. List every place that creates or changes something tied to your account: registration, profile edit, settings, invitations, team membership, password change.
  2. Capture the normal request and note every field the browser sends.
  3. Add fields that probably exist in the code but are not normally sent, using names hinted at by responses and error messages: role, isAdmin, isSuperAdmin, permissions, verified, status, owner, tenant.
  4. Send the modified request and check the response and the account itself, for example by reloading the profile or opening a page only privileged users can reach.
  5. Also try changing the type of existing fields: booleans as strings, arrays where a single value is expected, and numeric IDs belonging to another account.
  6. For invite or reset codes, check whether checking them is rate limited and whether the code space is small enough to enumerate.

A positive result is a response or later state change that reflects the value you injected, such as an admin-only page loading or a role field returning what you sent. Common false positives are values that are echoed back and stored but never used for permission decisions, and fields the framework silently drops. Always confirm the privilege actually works by performing a privileged action.

In general, how it is fixed

Copy request data only into an explicit list of allowed fields. Never accept role, permission or ownership attributes from the client; set them in server-side logic when the account is created, and change them only through dedicated, authorised endpoints. Apply the same rule to nested objects. Add rate limiting and lockout to invite code and token checks, and make codes long and random. For the IDOR side, check on every read and write that the logged-in user owns or may access the record being referenced, and avoid putting sensitive fields such as email and password into editable request or response bodies.

Glossary

  • Invite code: a short secret that must be entered to create an account.
  • Rate limiting: a server rule that caps how many requests you can make in a period of time.
  • Brute force: trying many possible values until one works.
  • Wordlist: a file of candidate values used for guessing.
  • SecLists: a public collection of wordlists used in security testing.
  • Burp Suite: a tool that intercepts and lets you edit traffic between browser and website.
  • Turbo Intruder: a Burp Suite extension for sending large numbers of requests quickly.
  • Request: the message your browser sends to a server asking for something.
  • Response: the message the server sends back.
  • Parameter: a named value sent in a request, such as a form field.
  • Flag: a true/false setting, such as whether a user is an admin.
  • Role: the level of permission an account has.
  • Privilege escalation: gaining more permissions than you were meant to have.
  • Mass assignment (autobinding): a framework copying request fields onto an object by name, including fields the client should not control.
  • Allowlist: an explicit list of things that are permitted, with everything else refused.
  • IDOR: a request that names a record by identifier without the server checking you may access it.
  • Account takeover: gaining control of another person's account.
  • CVSS: a standard scoring system for the severity of a vulnerability.
  • False positive: a finding that looks real but is not actually exploitable.

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.