Code flaws leads to Org/Admin Account Takeover
The application used a client-supplied 'c_id' parameter during account creation to assign the new user to an organisation, allowing an attacker to join any organisation by changing that value. Additionally, the organisation name field was vulnerable to stored cross-site scripting, and the attacker could change the victim's organisation name via an unauthenticated request, leading to session hijacking and account takeover.
Published on mr23r0.medium.com
Hello Everyone, I’m Saransh Saraf and I’m back with another unique account takeover idea, so let’s just dive into it :)
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.
Context
This write-up describes a chain of flaws in a multi-tenant portal that led to an organisation takeover and, from there, to an admin account takeover. The application allowed only one Admin/Manager per organisation, while other viewers had to log in to view content. Once an account was created, the user could not change the organisation name through the normal interface.
The researcher, Saransh Saraf (@mr23r0), walks through the design of the application, the registration request, and how a parameter in that request could be manipulated to reach another tenant.

The image above is the article's title card, captioned "code flaws leads to account takeover".
Setup
The testing was done against a portal; the captured request shows the host as portal.example.com. The researcher created an account through the normal onboarding flow and inspected the registration request in an intercepting proxy. The captured request carries a Chrome 105 on Linux user agent string.
The key precondition is that the application supports only one Admin/Manager per organisation, and that the organisation name cannot be changed after account creation through the UI.
Finding it
While creating an account, the researcher noticed a parameter in the POST request that looked out of place: c_id. The registration request was sent to an AJAX endpoint named create_event_flow, with a JSON body describing the onboarding method, user parameters, and community (organisation) parameters.
The full captured request is reproduced below exactly as it appears in the write-up:
POST /some_ajax/create_event_flow HTTP/1.1Host: portal.example.comConnection: closeContent-Length: 663sec-ch-ua: "Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"Accept: application/json, text/javascript, */*; q=0.01Content-Type: application/json; charset=UTF-8X-Requested-With: XMLHttpRequestsec-ch-ua-mobile: ?0User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[redacted] Safari/537.36sec-ch-ua-platform: "Linux"Origin: https://portal.example.comSec-Fetch-Site: same-originSec-Fetch-Mode: corsSe;c-Fetch-Dest: emptyReferer: https://portal.example.com/create_event_flowAccept-Encoding: gzip, deflateAccept-Language: en-GB,en-US;q=0.9,en;q=0.8Cookie:{"methodName":"onboard","params":{"some_params":{"some_name":"Account takeover","some_modules":[1]},"user_params":{"name":"User_name","email":"[redacted]","password":"Password_Secret"},"community_params":{"name":"Organization_name","slug":"testthing-for-ato","c_id":683,"client_time_zone":"Asia/Calcutta"}}}
The body contains three groups of parameters:
some_params, with a name and a list of modules.user_params, with the new user's name, email and password.community_params, with the organisation name, slug,c_idand client time zone.
The c_id value in the captured request is 683. The researcher reasoned about what the backend does with it: on registration the application creates an entry with the email address and creates a row in the organisation table (if it is SQL). The request then goes into the users table and creates a user tied to a predefined organisation. The write-up illustrates this with the following statement:
INSERT INTO users (username, password, organization) VALUES ("Jack","123", "organization_name") WHERE c_id='683';
Changing c_id to the victim's value placed the new account in the victim's organisation.
Exploitation
Step 1: Change c_id to the victim's organisation
The researcher changed c_id from their own value to the victim's c_id. As expected, the new account was placed in the victim's organisation. This is a horizontal privilege escalation: a user gains the access rights of another user at the same access level. The write-up notes that the application does not support multiple Admin/Manager accounts in one organisation, which makes this placement significant.
Step 2: Find stored XSS in the organisation name
After roughly 15 minutes of further searching, the researcher found a stored cross-site scripting issue in the Organization_name field. The problem was how to change the victim's organisation name, since the UI does not allow it after account creation.
Step 3: Replay the onboarding request with the victim's c_id and an XSS payload
The researcher replicated the create-account request and found that a POST to /some_ajax/create_event_flow requires no authentication. By putting a cross-site scripting payload in Organization_name and changing c_id to the victim's c_id, the victim's Organization_name is changed. The write-up does not include the exact payload used.

The image above shows the login page and dashboard, captioned "login page, dashboard".
Step 4: Obtain the victim's active cookies
With the stored payload in the victim's organisation name, the researcher obtained the victim's active cookies. The write-up does not show the exfiltration request or the cookie values.
Step 5: Session fixation / no logout
The researcher checked for session fixation and for a missing logout, and found the application vulnerable. The write-up does not give the exact test or the server response.
Step 6: Change password and email without the current password
The application asked for the current password when changing the password, but after intercepting the request the researcher found that the current password was neither sent nor checked. There was also no authentication on the change-email operation. The write-up does not include the intercepted request.
Wrap-up
The researcher summarised the chain as follows:
Create an account --> change the "c_id" and add the blind xss payload in the "organization_name"copy the victim's cookies Login as the victim by using the cookieschange the password by using: i. Change Password ii. Change Email --> Recover password
In short: create an account, change c_id, inject a blind XSS payload into organization_name, copy the victim's cookies, log in as the victim with those cookies, then change the password through either the change-password or the change-email plus password-recovery route. The write-up closes by asking whether this is an organisation takeover or an admin account takeover, and notes that the bug was triaged.
Root cause
The registration endpoint accepts the organisation identifier (c_id) from the client and uses it to place the new user in an organisation, instead of deriving the organisation from the authenticated session or from a server-side onboarding record. The endpoint also requires no authentication.
The organisation name field was vulnerable to stored cross-site scripting. The researcher checked for session fixation and missing logout and found the application vulnerable. The password-change flow does not verify the current password server-side, and the change-email operation has no authentication, so once a session is obtained the attacker can take over the account permanently. The write-up presents these as design and code flaws; the exact server-side implementation is not shown.
Impact
By changing c_id to the victim's value, an account could be created inside the victim's organisation. By combining this with stored XSS in the organisation name, the attacker can obtain the victim's active cookies and log in as the victim. Because the password-change flow does not check the current password and the change-email operation is unauthenticated, the attacker can change the password or the email and recover the account, which the researcher framed as either an organisation takeover or an admin account takeover..
Fix
Based on the flaws described, the following changes would address them:
- Derive the organisation from the authenticated session or from a server-side onboarding record, and never trust a client-supplied
c_id. - Require authentication on the onboarding endpoint and enforce authorisation checks on every organisation-scoped operation.
- Encode the organisation name on output to prevent stored XSS.
- Rotate the session identifier on login and invalidate it on logout to prevent session fixation.
- Verify the current password server-side on password change, and require authentication and authorisation on change-email.
Variants to test
- Client-supplied tenant identifiers: look for parameters such as
c_id,org_id,tenant_idorcommunity_idin registration and onboarding requests. A positive result is a new account appearing in another tenant's context. - Unauthenticated onboarding endpoints: replay the registration request without cookies. A positive result is a successful account creation or organisation update.
- Stored XSS in organisation or profile fields: inject a payload into fields that are displayed to other users, such as the organisation name. A positive result is script execution in another user's session.
- Session fixation and missing logout: set a session cookie before login and check whether it changes afterwards; check whether a logged-out cookie still works. A positive result is a cookie that remains valid across login or logout.
- Password change without current password: intercept the change-password request and remove the current-password field. A positive result is a successful password change.
- Unauthenticated change-email: replay the change-email request without a session. A positive result is a changed email address, which can then be used for password recovery.
What happened, in plain words
Imagine a shared office building where each company rents its own floor. Every floor has a front door with a lock, and the building manager hands out keys only to the people who work on that floor. Now imagine the key-cutting machine in the lobby asks you which floor you want your key to open, and it simply believes whatever you type. You type the number of a floor you do not work on, and the machine cuts you a key to it. That is the shape of the first bug in this write-up.
The application in this story is a portal where organisations (companies, teams, communities) sign up and their members log in to view content. Each organisation is meant to have exactly one Admin or Manager, and other people join as viewers. The portal keeps every organisation's data separate from every other organisation's data. In security language we call this a multi-tenant application: one piece of software serving many separate customers, like one apartment block with many flats.
The researcher, Saransh Saraf (@mr23r0), found that the sign-up request contained a number identifying which organisation the new account should belong to. That number came from the browser, not from the server, so it could be edited. By changing it, he could create an account inside someone else's organisation. He then found a second flaw: the organisation name field accepted script code, and that code ran in the browser of anyone who viewed the organisation. Combining the two, he could run code in a victim's session, steal the victim's login cookies, and use them to log in as the victim. Finally, he found that the password change did not really check the old password, and that changing the email address required no login at all. Together these let him take over an admin account completely.

The image above is the title card of the article, captioned "code flaws leads to account takeover".
Before going further, a few words on the pieces involved, because the rest of the article leans on them.
- A web request is the message your browser sends to a server when you click something or submit a form. It has a method (such as GET or POST), a path (the address on the server), headers (extra information like which browser you use) and often a body (the data you are submitting).
- An API (Application Programming Interface) is the set of addresses a website's own pages talk to behind the scenes. When you fill in a form and the page updates without reloading, your browser is usually sending a request to an API endpoint. Think of it as the service counter behind the shop front: customers do not walk into the stockroom, they hand a slip to the counter, and the counter fetches what is needed.
- JSON is a text format for structured data, made of names and values in curly braces. It is how the browser packages the form data before sending it to the API.
- A cookie is a small piece of text a server asks your browser to store and send back with every later request. It is how the server recognises you between page loads. If the cookie is your session cookie, anyone who copies it can pretend to be you, exactly like someone who photocopies your building key.
- A session is the server-side record of you being logged in. The cookie is the ticket; the session is the cloakroom behind the counter that holds your coat.
- SQL is the language databases use to store and fetch rows of data. A table is like a spreadsheet: rows are records, columns are fields. A row is one record, for example one user.
- Cross-site scripting (XSS) is a flaw where a website takes text from a user and later shows it to other users without neutralising it, so that text is treated as code by the browser. If the text is a piece of JavaScript, the browser runs it. Stored XSS means the malicious text is saved on the server (for example in a database field) and runs every time someone views it. Blind XSS means the attacker cannot see the result directly; the payload fires somewhere they cannot watch, such as an admin panel.
- Privilege escalation means gaining more access than you should have. Horizontal escalation means reaching another account at the same level as yours (another ordinary user, or another organisation's admin). Vertical escalation means going up a level (from viewer to admin).
- Account takeover means getting full control of someone else's account, usually by obtaining their session or changing their credentials.
- Session fixation is a flaw where the server keeps the same session identifier before and after login, so an attacker who plants a known identifier can later ride on the victim's authenticated session. A missing logout means the server does not invalidate the session when you log out, so a copied cookie keeps working.
Setup
The testing was done against a portal; the captured request shows the host as portal.example.com. The researcher created an account through the normal onboarding flow and inspected the registration request in an intercepting proxy. An intercepting proxy is a tool that sits between your browser and the server and lets you pause, read and edit each request before it is sent. Think of it as a postal worker who lets you open and rewrite a letter before delivering it. The captured request carries a Chrome 105 on Linux user agent string.
Two preconditions matter for everything that follows. First, the application supports only one Admin or Manager per organisation. Second, once an account is created, the user cannot change the organisation name through the normal interface. Both of these shape the attack: the first makes it valuable to land inside someone else's organisation, and the second means the attacker has to find another way to change the organisation name.
Finding it
While creating an account, the researcher noticed a parameter in the POST request that looked out of place: c_id. A parameter is simply a named value in a request, like a field on a paper form. The registration request was sent to an AJAX endpoint named create_event_flow, with a JSON body describing the onboarding method, the user's details, and the community (organisation) details. AJAX is the technique a web page uses to talk to the server in the background without reloading the page.
The full captured request is reproduced below exactly as it appears in the write-up:
POST /some_ajax/create_event_flow HTTP/1.1Host: portal.example.comConnection: closeContent-Length: 663sec-ch-ua: "Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"Accept: application/json, text/javascript, */*; q=0.01Content-Type: application/json; charset=UTF-8X-Requested-With: XMLHttpRequestsec-ch-ua-mobile: ?0User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[redacted] Safari/537.36sec-ch-ua-platform: "Linux"Origin: https://portal.example.comSec-Fetch-Site: same-originSec-Fetch-Mode: corsSe;c-Fetch-Dest: emptyReferer: https://portal.example.com/create_event_flowAccept-Encoding: gzip, deflateAccept-Language: en-GB,en-US;q=0.9,en;q=0.8Cookie:{"methodName":"onboard","params":{"some_params":{"some_name":"Account takeover","some_modules":[1]},"user_params":{"name":"User_name","email":"[redacted]","password":"Password_Secret"},"community_params":{"name":"Organization_name","slug":"testthing-for-ato","c_id":683,"client_time_zone":"Asia/Calcutta"}}}
Line by line, in plain words:
POST /some_ajax/create_event_flow HTTP/1.1is the first line of the request.POSTis the method used to submit data./some_ajax/create_event_flowis the path on the server.HTTP/1.1is the version of the protocol.Host: portal.example.comtells the server which site the request is for.Connection: close,Content-Length: 663and thesec-ch-ua,sec-ch-ua-mobile,sec-ch-ua-platformlines are housekeeping headers: how to handle the connection, how big the body is, and which browser and platform are being used.Accept: application/json, text/javascript, */*; q=0.01says what kind of response the browser will accept.Content-Type: application/json; charset=UTF-8says the body is JSON text.X-Requested-With: XMLHttpRequestmarks the request as coming from a background script rather than a full page load.User-Agent: Mozilla/5.0 ... Chrome/[redacted] Safari/537.36identifies the browser.Origin: https://portal.example.comandReferer: https://portal.example.com/create_event_flowsay which page the request came from.Sec-Fetch-Site: same-origin,Sec-Fetch-Mode: corsandSe;c-Fetch-Dest: emptyare browser security hints about the request's context.Accept-Encoding: gzip, deflateandAccept-Language: en-GB,en-US;q=0.9,en;q=0.8say the browser can accept compressed responses and prefers British English.Cookie:is where the browser would normally send its cookies. TheCookie:header appears in the capture; the report does not comment on its value.- The body is the JSON object.
methodNameisonboard, meaning this is the sign-up flow.paramsholds three groups:some_params(a name and a list of modules),user_params(the new user's name, email and password) andcommunity_params(the organisation name, slug,c_idand client time zone).
The c_id value in the captured request is 683. The researcher reasoned about what the backend does with it: on registration the application creates an entry with the email address and creates a row in the organisation table (if it is SQL). The request then goes into the users table and creates a user tied to a predefined organisation. The write-up illustrates this with the following statement:
INSERT INTO users (username, password, organization) VALUES ("Jack","123", "organization_name") WHERE c_id='683';
In plain words, this line is meant to show the idea: a new row is written into the users table, with a username, a password and an organisation, and the organisation is chosen by matching c_id to 683. The important point is not the exact SQL syntax but where the number comes from. Changing c_id to the victim's value placed the new account in the victim's organisation. In security terms, the server is taking an instruction from the browser about which tenant to join, instead of deciding that itself.
Exploitation
Step 1: Change c_id to the victim's organisation
The researcher changed c_id from their own value to the victim's c_id. As expected, the new account was placed in the victim's organisation. This is a horizontal privilege escalation: a user gains the access rights of another user at the same access level. The write-up notes that the application does not support multiple Admin or Manager accounts in one organisation, which makes this placement significant. In everyday terms, the key-cutting machine accepted a floor number from the customer, and the customer typed a floor they did not work on.
Step 2: Find stored XSS in the organisation name
After roughly 15 minutes of further searching, the researcher found a stored cross-site scripting issue in the Organization_name field. The problem was how to change the victim's organisation name, since the UI does not allow it after account creation. This is where the first bug becomes useful: the onboarding request can place a new account inside the victim's organisation, and that same request also carries the organisation name. If the name is saved and later shown to other users without being neutralised, the script inside it will run in their browsers.
Step 3: Replay the onboarding request with the victim's c_id and an XSS payload
The researcher replicated the create-account request and found that a POST to /some_ajax/create_event_flow requires no authentication. Authentication means proving who you are, usually by logging in. An endpoint that requires no authentication can be called by anyone who knows its address and the shape of its body. By putting a cross-site scripting payload in Organization_name and changing c_id to the victim's c_id, the victim's Organization_name is changed. The write-up does not include the exact payload used.

The image above shows the login page and dashboard, captioned "login page, dashboard".
Step 4: Obtain the victim's active cookies
With the stored payload in the victim's organisation name, the researcher obtained the victim's active cookies. In plain words, With the stored payload in the victim's organisation name, the researcher obtained the victim's active cookies. The write-up does not show the exfiltration request or the cookie values.
Step 5: Session fixation / no logout
The researcher checked for session fixation and for a missing logout, and found the application vulnerable. To understand why this matters: if the server keeps the same session identifier before and after login, or if logging out does not actually invalidate the session on the server, then a copied cookie keeps working. The write-up does not give the exact test or the server response.
Step 6: Change password and email without the current password
The application asked for the current password when changing the password, but after intercepting the request the researcher found that the current password was neither sent nor checked. There was also no authentication on the change-email operation. In everyday terms, the form on the screen asked for the old password, but the request that actually reached the server did not carry it, and the server did not complain. The write-up does not include the intercepted request.
Wrap-up
The researcher summarised the chain as follows:
Create an account --> change the "c_id" and add the blind xss payload in the "organization_name"copy the victim's cookies Login as the victim by using the cookieschange the password by using: i. Change Password ii. Change Email --> Recover password
Read as a sequence of steps, this says: create an account, change c_id, inject a blind XSS payload into organization_name, copy the victim's cookies, log in as the victim with those cookies, then change the password through either the change-password route or the change-email plus password-recovery route. The write-up closes by asking whether this is an organisation takeover or an admin account takeover, and notes that the bug was triaged. Triaged means the security team reviewed the report and accepted it as a real issue.
Root cause
The registration endpoint accepts the organisation identifier (c_id) from the client and uses it to place the new user in an organisation, instead of deriving the organisation from the authenticated session or from a server-side onboarding record. The endpoint also requires no authentication.
The organisation name field was vulnerable to stored cross-site scripting. Output encoding means converting characters that have special meaning in HTML (such as < and >) into harmless equivalents before showing them, so the browser displays them as text rather than running them as code.
The researcher checked for session fixation and missing logout and found the application vulnerable. The password-change flow does not verify the current password server-side, and the change-email operation has no authentication, so once a session is obtained the attacker can take over the account permanently. The write-up presents these as design and code flaws; the exact server-side implementation is not shown.
Impact
By changing c_id to the victim's value, an account could be created inside the victim's organisation. By combining this with stored XSS in the organisation name, the attacker can obtain the victim's active cookies and log in as the victim. Because the password-change flow does not check the current password and the change-email operation is unauthenticated, the attacker can change the password or the email and recover the account, which the researcher framed as either an organisation takeover or an admin account takeover.. CVSS is a standard scoring system for rating the severity of a vulnerability.
Fix
Based on the flaws described, the following changes would address them:
- Derive the organisation from the authenticated session or from a server-side onboarding record, and never trust a client-supplied
c_id. - Require authentication on the onboarding endpoint and enforce authorisation checks on every organisation-scoped operation. Authorisation means checking whether a logged-in user is allowed to do the thing they are asking for.
- Encode the organisation name on output to prevent stored XSS.
- Rotate the session identifier on login and invalidate it on logout to prevent session fixation.
- Verify the current password server-side on password change, and require authentication and authorisation on change-email.
Variants to test
- Client-supplied tenant identifiers: look for parameters such as
c_id,org_id,tenant_idorcommunity_idin registration and onboarding requests. A positive result is a new account appearing in another tenant's context. - Unauthenticated onboarding endpoints: replay the registration request without cookies. A positive result is a successful account creation or organisation update.
- Stored XSS in organisation or profile fields: inject a payload into fields that are displayed to other users, such as the organisation name. A positive result is script execution in another user's session.
- Session fixation and missing logout: set a session cookie before login and check whether it changes afterwards; check whether a logged-out cookie still works. A positive result is a cookie that remains valid across login or logout.
- Password change without current password: intercept the change-password request and remove the current-password field. A positive result is a successful password change.
- Unauthenticated change-email: replay the change-email request without a session. A positive result is a changed email address, which can then be used for password recovery.
Glossary
- AJAX: a technique where a web page talks to the server in the background without reloading the page.
- API: the set of addresses and rules a website's own pages use to exchange data with the server.
- Authentication: proving who you are, usually by logging in.
- Authorisation: checking whether a logged-in user is allowed to perform a given action.
- Blind XSS: cross-site scripting where the attacker cannot directly see the result, because the payload fires somewhere they cannot watch.
- Cookie: a small piece of text stored by the browser and sent back to the server with later requests, often used to identify a session.
- CVSS: a standard scoring system for rating the severity of a vulnerability.
- Horizontal privilege escalation: gaining access to another account at the same access level as your own.
- Intercepting proxy: a tool that sits between the browser and the server and lets you pause, read and edit requests.
- JSON: a text format for structured data made of names and values.
- Multi-tenant: one application serving many separate customers, each with its own isolated data.
- Output encoding: converting characters with special meaning in HTML into harmless equivalents before displaying them.
- Parameter: a named value in a request, like a field on a form.
- Privilege escalation: gaining more access than you should have.
- Session: the server-side record of a logged-in user, referenced by a cookie.
- Session fixation: a flaw where the server keeps the same session identifier before and after login, letting an attacker ride on a victim's session.
- SQL: the language databases use to store and fetch rows of data.
- Stored XSS: cross-site scripting where the malicious text is saved on the server and runs whenever someone views it.
- Table: in a database, a collection of records organised in rows and columns.
- Triaged: reviewed by a security team and accepted as a real issue.
- Web request: the message a browser sends to a server, with a method, path, headers and often a body.