Restricted fields manipulation
Description
From the self-management functionality for the registration of an employee, it is possible to change the information of other employees from other companies. An attacker can initiate a request to confirm the registration of an employee and change the DNI to different values so that it replaces the existing data. In this way the information sent will be stored in the company, updating all the information of the targeted employees such as names, e-mail addresses, dates of birth, addresses, telephone numbers, among others.
Impact
Modify or replace the information of other employees independently of the company.
Recommendation
Verify that the user who is trying to modify the information has the necessary permissions to access.
Threat
External attacker with access to employees information.
Expected Remediation Time
⌚ 15 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: H
- User interaction: N
- Scope: U
- Confidentiality: N
- Integrity: H
- Availability: N
Temporal
- Exploit code madurity: X
- Remediation level: X
- Report confidence: X
Result
- Vector string: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:N/E:X/RL:X/RC:X
- Score:
- Base: 4.9
- Temporal: 4.9
- Severity:
- Base: Medium
- Temporal: Medium
Code Examples
Compliant code
The application correctly verifies the user authorization before accessing sensitive information
const createUser = (req, res) => {
//Verify userId is not already registered
if (!isValidUser(req.body.userId)) {
const userId = req.body.userId;
const userCredentials = req.body.credentials;
if(isAuthuser(userCredentials)){
updateUserDB(userId, req.body.info);
}
}
}
Non compliant code
The application does not verify user credentials before allowing editing access
const createUser = (req, res) => {
const userId = req.body.userId;
//The function to add user information depends on the userId and does not validate if userId already exists
updateUserDB(userId, req.body.info);
}