Skip to main content

Unauthorized access to files

Description

In the functionality corresponding to update user data, it is possible to inject potentially dangerous characters that generate inappropriate behavior in the application, exposing the access to Sharepoint and allowing the user to access functionalities and files without authorization.

Impact

  • Access the Sharepoint administrative center.
  • Access files without authorization.

Recommendation

Validate on the server side the types of data that are entered into different types of fields in the application. Restrict file access to authenticated and authorized users only.

Threat

Attacker authenticated from the Internet.

Expected Remediation Time

⌚ 45 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: L
  • User interaction: N
  • Scope: U
  • Confidentiality: L
  • Integrity: N
  • Availability: N

Temporal

  • Exploit code madurity: X
  • Remediation level: X
  • Report confidence: X

Result

  • Vector string: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N/E:X/RL:X/RC:X
  • Score:
    • Base: 4.3
    • Temporal: 4.3
  • Severity:
    • Base: Medium
    • Temporal: Medium

Code Examples

Compliant code

The application restricts access to sensitive information to authorized users

app.post('/editProfile', isLoggedIn, function(req, res, next){
User.update({ _id: req.user.id}, req.body, function(err, user){
var usernameEdit = req.body.username;
//Validate data before editing
if(!isValidData(req.body)){
req.flash('error', 'Found several conflicting fields');
res.redirect('/edit');
}
else{
user.email = emailEdit;
user.local.email = emailEdit;
user.first_name = first_nameEdit;
user.last_name = last_nameEdit;
user.username = usernameEdit;
res.redirect('/profile/');
}
}
});

Non compliant code

The application allows unauthorized users to access sensitive information

app.post('/editProfile', isLoggedIn, function(req, res, next){
User.update({ _id: req.user.id}, req.body, function(err, user){
//Updating user without validating data
user.email = emailEdit;
user.local.email = emailEdit;
user.first_name = first_nameEdit;
user.last_name = last_nameEdit;
user.username = usernameEdit;
res.redirect('/profile/');
}
});

Requirements