Luminate Internal Privilege Escalation — Admin to Owner
An invited administrator could modify the profile update request to change the owner's role to admin and set the owner's expiration date to the current day, thereby removing the owner's access. The attacker could also extend their own expiration date to become a permanent member.
Published on medium.com
Luminate offers three different services in their platform: 1) Web Hosting, 2) Store CMS and 3) Marketing. This is vulnerability writeup on Web Hosting service.
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
Luminate was a platform offering three services: web hosting, a store CMS and marketing. This write-up covers the web hosting service, and it is part of a series of write-ups about vulnerabilities found in Yahoo while taking part in Yahoo's bug bounty programme.
After buying Luminate's web hosting service, a user gets access to several internal services:
- Web hosting (managing addons, installing software)
- Email service
- Access manager
The access manager is where the owner invites other users to help manage the domain and its hosting. An invited user has one of two roles: administrator, or limited user with access to only the tools the owner specifies.
Setup
Two accounts are used throughout:
- User A is the owner of the organisation.
- User B is an invited administrator.
Once invited, User B has access to the web hosting service, the access manager and all other services except the payment information for the organisation. Through the access manager, User B can also invite other users and edit their profiles. When editing a profile, User B can change only the name, not the email or the expiration date. That restriction is where the flaw sits.
Finding it
Saving a profile sends a POST request with the following data:
{"alias":"{name}","company":"","creation":1501976914,"email":"{email}","expiration":1517903999,"guid":"","modification":1501977146,"roles":{"actorrolesarray":[{"application":"YAHOO","creation":1501976914,"creator":"{usera_id}","display":"{role_name}","modification":1501976914,"name":"{role_id}"}],"count":1,"start":0,"total":1},"status":"ACTIVE","yuid":"{userb_id}"}&profile_yuid={userb_id}&crumb={crumb}&action=update
Two fields matter: role_id and usera_id.
To see how the system behaved, the researcher first changed role_id from Admin to Owner. The system assigned the Owner role, but because the default owner, User A, was still present, the researcher did not yet have owner permissions.
The next goal was to remove the main owner. That was protected: User A's profile could not be edited, even by User A.
Looking further, the user ids for both accounts stood out. When User B's profile was saved, User A's id was visible in the creator parameter. User B's id appeared in two places: yuid and profile_yuid. That suggested the section could be manipulated into a stronger attack.
Exploitation
Step 1: find the owner's creator id
The creator id for the owner had to be found first. This was simple: the source code of the page disclosed it. User A's creator id turned out to be User A's own id, because there were no users before that account.
Step 2: swap the target ids
The profile_yuid and yuid values, which held User B's id, were replaced with User A's id. The {role_id} was then changed to Admin, because User A already had role_id set to Owner. The request was sent, and initially it did not work.
Step 3: change the remaining profile fields
After about 30 minutes of investigation, the researcher found that three more inputs had to change: alias, email and expiration. These were set to User A's data, also obtained from the source code.
Once that was done, User A was no longer an owner but an admin instead.
Step 4: expire the original owner
The expiration date of User A was then changed to the day of the attack. Once that day passed, User A had no access to edit web hosting, email management or the access manager.
The short-expiration variant
The same exploit worked when User B's expiration date was very short. If User A invited User B for about one day to manage something, User B could modify the expiration parameter and become a permanent member.
Root cause
The profile update accepted client-supplied identity and role data. The yuid and profile_yuid parameters, which select whose profile is being written, were accepted from the request rather than bound to the authenticated session, so an administrator could point the update at the owner's profile. The roles.actorrolesarray[].name value (role_id) was likewise taken from the request, letting the caller set the role. The page source exposed the owner's id, alias, email and expiration, which were needed to make the write succeed. The name-only edit restriction did not stop the extra fields from being changed in the request. The protection on the owner's profile was bypassed by targeting User A's identifiers.
Impact
An invited administrator could take over the owner role of the organisation. By rewriting the owner's profile, the attacker demoted the real owner to admin and then set the owner's expiration date to the day of the attack, removing the owner's access to web hosting, email management and the access manager once that day passed. The same manipulation let a short-lived invited user turn a temporary membership into a permanent one. The report does not describe any further consequences beyond loss of the owner's access to those services.
Fix
The report does not state what was changed. Based on the root cause, the server should bind the profile update to the authenticated user's own id rather than accepting yuid and profile_yuid from the request, and it should authorise role changes against the caller's actual role instead of trusting role_id. The owner's profile should be protected server-side, and the name-only edit restriction should be enforced on the server, not just in the UI.
Variants to test
- Swap the profile identifier parameters (
yuid,profile_yuidor equivalents) to another user's id and see whether the response reflects a change to that user's profile. - Change the role identifier in the roles array to a higher role and check whether the account is granted it.
- Send fields the UI does not expose, such as email and expiration, and see whether the server accepts them.
- Look for creator or owner ids in page source and use them to target the owner's profile.
- Set a short expiration on an invited account, then modify the expiration parameter and check whether the membership becomes permanent.
Timeline
- August 5, 2017: report submitted
- August 10, 2017: changed to triaged
- September 5, 2017: report resolved
- September 13, 2017: bounty awarded
What happened, in plain words
Luminate was a service that let people build and run websites. It offered three products: web hosting, a store CMS (a system for running an online shop) and marketing tools. This write-up is about the web hosting product, and it is one of a series about bugs found in Yahoo's systems while taking part in Yahoo's bug bounty programme. A bug bounty programme is a scheme where a company pays independent researchers for reporting security problems instead of punishing them.
When someone buys Luminate's web hosting, they get access to several internal services:
- Web hosting, where they manage addons and install software
- An email service
- An access manager
The access manager is the part where the owner of a site invites other people to help run the domain and its hosting. An invited person gets one of two roles: administrator, or a limited user who can only use the tools the owner picks for them. Think of it like a shared household: the owner holds the keys to everything, an administrator can do most chores, and a limited user can only open the cupboards they were given.
The bug in this report is a privilege escalation. That is a class of vulnerability where someone with a lower level of permission finds a way to gain a higher one, here going from invited administrator to owner. The weakness is broken authorisation: the server did not properly check whether the person sending a request was allowed to do what the request asked.
The setup
Two accounts are used throughout the story:
- User A is the owner of the organisation.
- User B is an invited administrator.
Once invited, User B can use the web hosting service, the access manager and all the other services, with one exception: the payment information for the organisation. Through the access manager, User B can also invite other users and edit their profiles. When editing a profile, the interface lets User B change only the name, not the email address or the expiration date. That restriction is where the flaw sits.
An important idea here is the difference between what a web page shows you and what the server actually accepts. The page is just a form drawn by your browser. The real decisions are made by the server when it receives the request. If the server trusts whatever the request says, hiding a field in the page does not protect anything.
Finding it
Saving a profile sends a POST request with the following data:
{"alias":"{name}","company":"","creation":1501976914,"email":"{email}","expiration":1517903999,"guid":"","modification":1501977146,"roles":{"actorrolesarray":[{"application":"YAHOO","creation":1501976914,"creator":"{usera_id}","display":"{role_name}","modification":1501976914,"name":"{role_id}"}],"count":1,"start":0,"total":1},"status":"ACTIVE","yuid":"{userb_id}"}&profile_yuid={userb_id}&crumb={crumb}&action=update
A POST request is one of the ways a browser talks to a server: it sends data to be processed, as opposed to a GET request which mostly asks for a page. The block above is the body of that request, written in JSON, a text format for structured data where values sit next to names in "name":"value" pairs. The {...} placeholders stand for real values that were filled in at the time.
Going through it in plain words:
aliasis the display name,emailthe address,expirationa date written as a Unix timestamp (a count of seconds since 1 January 1970, a common way for computers to store dates).creationandmodificationare timestamps for when the record was created and last changed.rolesholds a list calledactorrolesarraydescribing which role the person has. Inside it,creatorrecords who created the role assignment,displayis the role's readable name andnameis the role's identifier.yuidis the user identifier of the person whose profile this is.- After the JSON, joined with
&, comeprofile_yuid(the profile being edited),crumb(a short anti-forgery token the site issues so that requests cannot easily be replayed from elsewhere) andaction=update.
Two fields matter for the attack: role_id and usera_id. The first says which role the person has; the second identifies the user who created that role assignment.
To see how the system behaved, the researcher first changed role_id from Admin to Owner. The system assigned the Owner role, but because the default owner, User A, was still present, the researcher did not yet have owner permissions. This is like adding your name to a list of directors: the list now says you are one, but the existing director still holds the keys.
The next goal was to remove the main owner. That was protected: User A's profile could not be edited, even by User A.
Looking further, the user ids for both accounts stood out. When User B's profile was saved, User A's id was visible in the creator parameter. User B's id appeared in two places: yuid and profile_yuid. That suggested the section could be manipulated into a stronger attack. If the request simply names whose profile to write, then perhaps it could be pointed at someone else's profile.
Exploitation
Step 1: find the owner's creator id
The creator id for the owner had to be found first. This was simple: the source code of the page disclosed it. Source code here means the HTML that your browser downloads to draw the page; anyone can view it with the browser's "view source" option. User A's creator id turned out to be User A's own id, because there were no users before that account.
Step 2: swap the target ids
The profile_yuid and yuid values, which held User B's id, were replaced with User A's id. The {role_id} was then changed to Admin, because User A already had role_id set to Owner. The request was sent, and initially it did not work.
The role was changed to Admin because User A already had role_id set to Owner. Writing it as Admin would take the owner's powers away.
Step 3: change the remaining profile fields
After about 30 minutes of investigation, the researcher found that three more inputs had to change: alias, email and expiration. These were set to User A's data, also obtained from the source code.
The report does not say why these extra fields were required. Once that was done, User A was no longer an owner but an admin instead.
Step 4: expire the original owner
The expiration date of User A was then changed to the day of the attack. Once that day passed, User A had no access to edit web hosting, email management or the access manager.
An expiration date is the moment an account or invitation stops being valid. Setting it to the day of the attack means the account lapses almost immediately, which locks the real owner out without deleting anything.
The short-expiration variant
The same exploit worked when User B's expiration date was very short. If User A invited User B for about one day to manage something, User B could modify the expiration parameter and become a permanent member. The same manipulation also let a short-lived invited user become a permanent member.
Why it worked
The profile update accepted identity and role data supplied by the client. The yuid and profile_yuid parameters, which select whose profile is being written, were accepted from the request rather than bound to the logged-in session, so an administrator could point the update at the owner's profile. The roles.actorrolesarray[].name value (role_id) was likewise taken from the request, letting the caller set the role. The page source exposed the owner's id, alias, email and expiration, which were needed to make the write succeed. The name-only edit restriction did not stop the extra fields from being changed in the request. The protection on the owner's profile was bypassed by targeting User A's identifiers.
A useful comparison is a hotel reception desk. If the clerk hands you a form and asks which room you want cleaned, and then simply cleans whichever room number you wrote, it does not matter that the form was printed with your own room number on it. The form is a suggestion; the clerk should check your key card. Here the server acted like the clerk.
Impact
An invited administrator could take over the owner role of the organisation. By rewriting the owner's profile, the attacker demoted the real owner to admin and then set the owner's expiration date to the day of the attack, removing the owner's access to web hosting, email management and the access manager once that day passed. The same manipulation let a short-lived invited user turn a temporary membership into a permanent one. The report does not describe any further consequences beyond loss of the owner's access to those services.
Fix
Based on the cause, the server should bind the profile update to the logged-in user's own id rather than accepting yuid and profile_yuid from the request, and it should check role changes against the caller's actual role instead of trusting role_id. The owner's profile should be protected on the server, and the name-only edit restriction should be enforced on the server, not just in the page.
Variants to test
These are the kinds of checks a researcher would repeat on similar sites:
- Swap the profile identifier parameters (
yuid,profile_yuidor equivalents) to another user's id and see whether the response reflects a change to that user's profile. - Change the role identifier in the roles array to a higher role and check whether the account is granted it.
- Send fields the page does not show, such as email and expiration, and see whether the server accepts them.
- Look for creator or owner ids in page source and use them to target the owner's profile.
- Set a short expiration on an invited account, then modify the expiration parameter and check whether the membership becomes permanent.
Timeline
- August 5, 2017: report submitted
- August 10, 2017: changed to triaged (a triage step is where the security team confirms the report is real and worth working on)
- September 5, 2017: report resolved
- September 13, 2017: bounty awarded
Glossary
- Access manager: the part of Luminate where an owner invites other users and assigns them roles.
- Administrator: an invited user who can manage most of the service but not the organisation's payment information.
- Alias: the display name shown for a user profile.
- API: a defined way for one piece of software to talk to another; here, the requests the web page sends to the server behind the scenes.
- Broken authorisation: a flaw where the server does not correctly check whether the person making a request is allowed to do what it asks.
- Bug bounty programme: a scheme where a company pays researchers for reporting security bugs responsibly.
- Client: the software on your side, usually the browser, that sends requests to a server.
- Cookie: a small piece of data a site stores in your browser so it can recognise you on later requests.
- Creator: in this report, the field recording which user created a role assignment.
- Crumb: a short token the site issues and expects back in a request, used to make forged requests harder.
- Endpoint: a specific address on a server that accepts a particular kind of request.
- Expiration: the date and time after which an account or invitation stops being valid.
- GET request: a request that mainly asks the server to return a page or data.
- HTML: the language used to describe the structure of a web page; your browser downloads it and draws the page from it.
- JSON: a text format for structured data, made of name and value pairs and lists.
- Limited user: an invited user who can only use the tools the owner selects.
- Owner: the account that holds full control of the organisation, including payment information.
- Parameter: a named value sent with a request, such as
yuidorexpiration. - POST request: a request that sends data to the server to be processed or stored.
- Privilege escalation: gaining a higher level of permission than you were given.
- Role: a label that decides what a user is allowed to do, such as owner or administrator.
- Root cause: the underlying reason a bug exists, as opposed to its visible symptom.
- Server: the computer that stores the data and decides what each request is allowed to do.
- Session: the server's record of who you are while you are logged in, usually tied to a cookie or token.
- Source code (of a page): the HTML your browser receives, which anyone can view.
- Timestamp: a date and time stored as a number, often seconds since 1 January 1970.
- Token: a short value used to prove identity or to protect a request from forgery.
- Triaged: the stage where a security team has confirmed a report and queued it for fixing.
- Unix timestamp: a count of seconds since 1 January 1970, used to store dates in computers.
- User id: the unique number or string that identifies an account.
- Vulnerability: a weakness in software that someone could abuse.
- Web hosting: a service that stores and serves a website for you.
- yuid: the user identifier field used in this report's requests.