Unveiling Vulnerabilities: Loose Permissions in Salesforce Lightning Pose Data Security Threats
Loose permissions on Salesforce Lightning objects allowed unauthenticated guest users to query records through the Aura API. An attacker could extract sensitive data from objects such as Case, Account, User, and Contact.
Published on samshadow.medium.com
Salesforce Lightning is a potent CRM solution that makes it easier to develop data-driven applications in the ever-evolving web application landscape. However, a recent vulnerability report has revealed possible security risks related to the loose permissions on some objects within the Salesforce Lightning instance at…
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
Salesforce Lightning is a CRM platform for building data-driven applications. The report concerns a Salesforce Lightning community instance reachable at https://example.com/s/sfsites/aura, the Aura endpoint that the Lightning front end uses for its component framework calls. The report states that guest (unauthenticated) users had been granted loose permissions on a set of standard objects, and that the Aura API could therefore be used to read records from those objects without logging in.
The objects named in the report are Case, Account, User, Contact, Document, ContentDocument, ContentVersion, ContentBody, CaseComment, Note, Employee, Attachment, EmailMessage, CaseExternalDocument, Lead, Name, EmailTemplate and EmailMessageRelation. The report does not describe what the affected site does beyond being a Lightning community.
Setup
The only tool the report names is Burp Suite, used as an intercepting proxy to capture HTTP(S) traffic. No account, role or credential is needed: the whole point is that the requests are sent as an unauthenticated guest. The precondition is a Lightning site whose guest user profile has been given access to the objects listed above, and a reachable /s/sfsites/aura endpoint.
Finding it
The guest user profile carried permissions on objects that hold user and case data. In Lightning, the Aura endpoint accepts a message parameter describing one or more actions, each with a server-side controller descriptor and parameters. If the guest profile can read an object, the built-in list controller returns its records to an unauthenticated caller. The flaw is therefore one of authorisation configuration rather than a broken parser: the endpoint does what it is asked, and the permissions say yes.
Exploitation
Step 1: Capture traffic
Ensure Burp Suite is sniffing all HTTP(S) requests in the background.
Step 2: Obtain a template Aura request
Navigate to https://example.com/s/. This is done to retrieve a template Aura request that can be reused, so that the request carries whatever framing the site expects.
Step 3: Send the request to Repeater
Find a POST request in Burp's Proxy history to the /s/sfsites/aura endpoint and send it to Repeater.
Step 4: Replace the message parameter
Change the message POST parameter to the payload below. All other parameters should remain untouched. In this example a pageSize of 100 is used for speed, but more records can be retrieved.
message={"actions":[{"id":"123;a","descriptor":"serviceComponent://ui.force.components.controllers.lists.selectableListDataProvider.SelectableListDataProviderController/ACTION$getItems","callingDescriptor":"UNKNOWN","params":{"entityNameOrId":"**<OBJECT>**","layoutType":"FULL","pageSize":100,"currentPage":0,"useTimeout":false,"getCount":false,"enableRowActions":false}}]}
The important parts:
descriptorpoints at the standardSelectableListDataProviderControllerand itsACTION$getItemsaction, a built-in controller method that returns list records.entityNameOrIdis the object to read, shown as the**<OBJECT>**placeholder; it is replaced with one of the objects named above.layoutTypeis set toFULL, so the full record layout is returned rather than a reduced field set.pageSizeis 100 andcurrentPageis 0, controlling how many records come back and from which page.getCountandenableRowActionsare false, anduseTimeoutis false.callingDescriptorisUNKNOWN, and the actionidis123;a.
Step 5: Submit the request
Submit the request. The response contains sensitive information belonging to other users.
The report does not include a sample response, so the exact shape of the returned JSON is not shown here.
Root cause
The platform's inability to implement adequate authorisation checks is caused by the loose permissions on particular objects within the Salesforce Lightning instance. In other words, the guest user profile was granted read access to objects it should not have had. The endpoint is reachable without authentication and the controller is a built-in one. The report does not say which specific permission settings were misconfigured or how the configuration came about.
Impact
Unauthenticated attackers can extract sensitive data from records within the affected objects. The report lists Case, Account, User, Contact, Document and others as sources of that data, and describes the result as a serious risk to the confidentiality and integrity of user information. The report does not quantify how many records or users were affected.
Fix
It recommends that security teams, administrators and developers work together on the necessary fixes, and that regular security audits and updates be used as proactive measures.
Variants to test
- Swap
entityNameOrIdfor each object named in the report (Case, Account, User, Contact, Document, ContentDocument, ContentVersion, ContentBody, CaseComment, Note, Employee, Attachment, EmailMessage, CaseExternalDocument, Lead, Name, EmailTemplate, EmailMessageRelation). A positive result is a response containing records for that object. - Increase
pageSizeand walkcurrentPageupwards. A positive result is additional records beyond the first page. - Set
getCountto true. A positive result is a count of records the guest can see, which indicates the size of the exposure. - Try other built-in list or record controllers through the same
descriptormechanism. A positive result is any controller action that returns record data to an unauthenticated caller. - Repeat the request without the session context of a logged-in user, for example from a fresh client. A positive result is the same data coming back, confirming the access is genuinely unauthenticated.
What happened, in plain words
Salesforce Lightning is a product made by Salesforce. It is a CRM, which stands for customer relationship management: a system where a company stores information about its customers, the cases (support tickets) those customers open, the people who work there, and the documents attached to all of it. Companies use it to build web applications on top of that data, and many of those applications have a public-facing part, called a community, that anyone on the internet can open in a browser.
One such Lightning community, reachable at https://example.com/s/sfsites/aura, had a permissions problem. The public, not-logged-in visitor of a Lightning site is called a guest user. On this site, the guest user had been given permission to read a long list of record types: Case, Account, User, Contact, Document, ContentDocument, ContentVersion, ContentBody, CaseComment, Note, Employee, Attachment, EmailMessage, CaseExternalDocument, Lead, Name, EmailTemplate and EmailMessageRelation. Those are the standard building blocks Salesforce uses to store support cases, customer accounts, user details, contacts, files and emails.
Because of that, an unauthenticated attacker could craft a request to the site's Aura API and get records back. The report does not describe what the affected site does beyond being a Lightning community.
To follow the rest of this article you only need to know how to use a browser. Everything else is explained as it comes up.
The pieces you need to know
Before walking through the steps, here are the few ideas the report relies on.
API. An API is a way for one piece of software to talk to another. Think of a restaurant: the menu and the waiter are the API. You do not walk into the kitchen yourself; you tell the waiter what you want in a fixed format, and food comes back. A web API works the same way: a program sends a structured request to a specific address, and the server sends structured data back. The address in this report is https://example.com/s/sfsites/aura.
Aura. Aura is the name of the framework Salesforce Lightning uses to build its pages. When you click around a Lightning page, your browser is quietly sending requests to the Aura endpoint behind the scenes, and the server answers with data that the page then draws on screen. The endpoint is the waiter's counter: everything the page needs goes through it.
HTTP request and POST. When your browser loads a page or submits a form, it sends an HTTP request. A POST request is the kind used to send data to the server, as opposed to simply asking for a page. The Aura endpoint receives POST requests that carry a parameter called message, which describes what the page wants the server to do.
Parameter. A parameter is a named value attached to a request, like a field on a form. The message parameter is one such field, and its value is a chunk of structured text.
JSON. JSON is a plain-text way of writing structured data, using curly braces for objects and square brackets for lists. The message value in this report is JSON.
Object. In Salesforce, an object is a type of record, roughly like a table in a spreadsheet. Case is the object holding support tickets; Account holds companies; Contact holds people. Each object has many records, one per ticket or company.
Authorisation. Authentication is proving who you are (logging in). Authorisation is what you are allowed to do once you are known. This report is entirely about authorisation: the guest user is allowed to do far too much.
Intercepting proxy. A proxy is a program that sits between your browser and the internet and can look at, and change, everything passing through. Burp Suite is one such tool. It is the only tool the report names. No account, role or credential is needed for any of this: the whole point is that the requests are sent as an unauthenticated guest.
Finding it
The guest user profile carried permissions on objects that hold user and case data. A profile in Salesforce is a bundle of permissions attached to a kind of user; the guest user profile is the one that applies to anonymous visitors.
In Lightning, the Aura endpoint accepts a message parameter describing one or more actions. Each action names a server-side controller (a piece of built-in server code that performs a task) and gives it parameters. If the guest profile can read an object, the built-in list controller returns that object's records to an unauthenticated caller. The flaw is therefore one of authorisation configuration rather than a broken parser: the endpoint does exactly what it is asked, and the permissions say yes. A useful comparison is a hotel receptionist who follows the rules perfectly but has been handed a key cabinet where every room key is labelled public.
Exploitation
Step 1: Capture traffic
Ensure Burp Suite is sniffing all HTTP(S) requests in the background.
Why: you want to record a real request that the site itself makes, so you can reuse its exact shape later. Burp Suite sits between your browser and the site and keeps a copy of every request and response.
Step 2: Obtain a template Aura request
Navigate to https://example.com/s/. This is done to retrieve a template Aura request that can be reused, so that the request carries whatever framing the site expects.
Why: a Lightning page sends many Aura requests as it loads. Any one of them is a ready-made example with all the extra fields the server expects. Starting from a real request is easier and more reliable than writing one from scratch.
Step 3: Send the request to Repeater
Find a POST request in Burp's Proxy history to the /s/sfsites/aura endpoint and send it to Repeater.
Why: Repeater is the part of Burp Suite that lets you take one captured request, edit it, send it again, and read the response, as many times as you like. The Proxy history is the list of everything Burp has recorded so far.
Step 4: Replace the message parameter
Change the message POST parameter to the payload below. All other parameters should remain untouched. In this example a pageSize of 100 is used for speed, but more records can be retrieved.
message={"actions":[{"id":"123;a","descriptor":"serviceComponent://ui.force.components.controllers.lists.selectableListDataProvider.SelectableListDataProviderController/ACTION$getItems","callingDescriptor":"UNKNOWN","params":{"entityNameOrId":"**<OBJECT>**","layoutType":"FULL","pageSize":100,"currentPage":0,"useTimeout":false,"getCount":false,"enableRowActions":false}}]}
Line by line, in plain words:
message=is the name of the form field being set. Everything after the equals sign is its new value.{"actions":[ ... ]}says: here is a list of actions I want the server to perform. The square brackets mean a list, and in this case the list holds one action."id":"123;a"is a label for this action, so the response can be matched back to the request. It is just an identifier; the report gives no special meaning to its value."descriptor":"serviceComponent://ui.force.components.controllers.lists.selectableListDataProvider.SelectableListDataProviderController/ACTION$getItems"is the important part. It points at a built-in Salesforce controller calledSelectableListDataProviderControllerand, after the slash, at itsACTION$getItemsaction, which returns a list of records. Think of it as choosing a dish by its exact name from the kitchen's internal menu."callingDescriptor":"UNKNOWN"is a field the server expects; the report sets it to the literal textUNKNOWN."params":{ ... }holds the settings for that action."entityNameOrId":"**<OBJECT>**"is which object to read. The**<OBJECT>**is a placeholder: you replace it with one of the object names listed earlier, such asCaseorAccount."layoutType":"FULL"asks for the full record layout, meaning all the fields, rather than a reduced set."pageSize":100asks for up to 100 records at a time. The report uses 100 for speed and notes that more records can be retrieved."currentPage":0asks for the first page of results. Pages are numbered from zero here."useTimeout":false,"getCount":falseand"enableRowActions":falseare switches, all turned off.getCountoff means the server does not also return a total count;enableRowActionsoff means no per-row action buttons are prepared;useTimeoutoff means no time limit is applied to the action.
Why this step matters: the request is now asking the server, through its own built-in list controller, to hand over records of a chosen object. Nothing in the request proves who the sender is, which is exactly the situation being tested.
Step 5: Submit the request
Submit the request. The response contains sensitive information belonging to other users.
Why: if the guest profile really can read the object, the server answers with the records. The report does not include a sample response, so the exact shape of the returned JSON is not shown here.
Root cause
The platform's inability to implement adequate authorisation checks is caused by the loose permissions on particular objects within the Salesforce Lightning instance. In other words, the guest user profile was granted read access to objects it should not have had. The endpoint is reachable without authentication and the controller is a built-in one. The report does not say which specific permission settings were misconfigured or how the configuration came about.
A comparison: a building's front door is unlocked for visitors, which is normal. The problem is that the visitors' key card also opens the filing room. The door and the lock work fine; the card was configured too generously.
Impact
Unauthenticated attackers can extract sensitive data from records within the affected objects. The report lists Case, Account, User, Contact, Document and others as sources of that data, and describes the result as a serious risk to the confidentiality and integrity of user information. Confidentiality means keeping data private; integrity means keeping it accurate and unaltered. The report does not quantify how many records or users were affected.
Fix
It recommends that security teams, administrators and developers work together on the necessary fixes, and that regular security audits and updates be used as proactive measures. In the hotel comparison, you take the public keys off the visitors' card and leave only the lobby and the café on it.
Variants to test
These are ways to explore the same issue further. Each one lists what a positive result looks like, so you know when you have found something.
- Swap
entityNameOrIdfor each object named in the report (Case, Account, User, Contact, Document, ContentDocument, ContentVersion, ContentBody, CaseComment, Note, Employee, Attachment, EmailMessage, CaseExternalDocument, Lead, Name, EmailTemplate, EmailMessageRelation). A positive result is a response containing records for that object. - Increase
pageSizeand walkcurrentPageupwards. A positive result is additional records beyond the first page. - Set
getCountto true. A positive result is a count of records the guest can see, which indicates the size of the exposure. - Try other built-in list or record controllers through the same
descriptormechanism. A positive result is any controller action that returns record data to an unauthenticated caller. - Repeat the request without the session context of a logged-in user, for example from a fresh client. A positive result is the same data coming back, confirming the access is genuinely unauthenticated.
Glossary
- API: a defined way for one program to ask another for data or actions, like a waiter taking your order to the kitchen.
- Aura: the framework Salesforce Lightning uses to build its pages, and the name of the endpoint those pages talk to.
- Authentication: proving who you are, usually by logging in.
- Authorisation: what you are allowed to do once your identity is known.
- Burp Suite: a tool that sits between your browser and a website, recording and letting you edit the requests and responses.
- Community: a public-facing part of a Salesforce site that anyone on the internet can open.
- Controller: a piece of server-side code that performs an action when asked, such as fetching a list of records.
- CRM: customer relationship management, software for storing customer, case and contact data.
- Descriptor: in an Aura request, the text that names which controller and action to run.
- Entity: another word for object, a type of record such as Case or Account.
- Guest user: the identity a Salesforce site uses for visitors who are not logged in.
- HTTP: the language browsers and web servers use to exchange requests and responses.
- Intercepting proxy: a tool placed between browser and server that can view and modify traffic; Burp Suite is one.
- JSON: a plain-text format for structured data, using braces for objects and brackets for lists.
- Object: a type of record in Salesforce, roughly a table holding many records of the same kind.
- Parameter: a named value sent with a request, like a field on a form.
- Payload: the part of a request that carries the data you are sending.
- POST: an HTTP request type used to send data to a server.
- Profile: a bundle of permissions in Salesforce that applies to a kind of user, including the guest user.
- Proxy history: Burp Suite's list of every request and response it has recorded.
- Repeater: the Burp Suite feature that lets you edit and resend a single request and read the reply.
- Record: one entry in an object, such as a single support case.
- Salesforce Lightning: Salesforce's platform for building data-driven web applications on top of CRM data.
- Session context: the information that ties a request to a logged-in user; a fresh client has none.