Business information leak - Firestore
Description
When attempting to activate a plan, it is evident that the responses to firestore API requests contain user credentials.
Impact
Obtain credentials from other services.
Recommendation
Ensure that responses to requests do not contain confidential information.
Threat
Anonymous attacker from the Internet.
Expected Remediation Time
⌚ 60 minutes.
Score
Default score using CVSS 3.1. It may change depending on the context of the vulnerability.
Base
- Attack vector: N
- Attack complexity: L
- Privileges required: N
- User interaction: N
- Scope: U
- Confidentiality: L
- Integrity: N
- Availability: N
Temporal
- Exploit code madurity: P
- Remediation level: X
- Report confidence: R
Result
- Vector string: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N/E:P/RL:X/RC:R
- Score:
- Base: 5.3
- Temporal: 4.8
- Severity:
- Base: Medium
- Temporal: Medium
Code Examples
Compliant code
The responses of the application do not include user sensitive data
let db = firebase.database();
app.get("/user/request", (req, res) => {
const userCredentials = req.body.user.token;
const ref = db.ref(req.body.reqDb);
//Code to retrieve information and send it back, without displaying user credentials
});
Non compliant code
The application attaches user credentials to the response of a db query
let db = firebase.database();
app.get("/user/request", (req, res) => {
const userCredentials = req.body.user.token;
const ref = db.ref(req.body.reqDb);
res.send(userCredentials);
res.send(ref);
});