Skip to main content

Insufficient data authenticity validation - Images

Description

The system does not validate that profile image URLs lead to a valid image, allowing partial paths or URLs to be placed that can be used to craft more complex attack vectors such as controlled redirects or CSRF.

Impact

Manipulate the application to send redirects to third-party pages and load content from unverified sources.

Recommendation

Validate that the URLs provided in the profile images lead to valid images.

Threat

Attacker with access to the application 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: L
  • User interaction: R
  • Scope: U
  • Confidentiality: N
  • Integrity: L
  • 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:R/S:U/C:N/I:L/A:N/E:X/RL:X/RC:X
  • Score:
    • Base: 3.5
    • Temporal: 3.5
  • Severity:
    • Base: Low
    • Temporal: Low

Code Examples

Compliant code

All user input is correctly validated before being used

app.post('/editProfile', isLoggedIn, function(req, res, next){
User.update({ _id: req.user.id}, req.body, function(err, user){
//Validate data before editing
if(!isValidData(req.body.NewImg)){
req.flash('error', 'Found errors on the data');
res.redirect('/edit');
}
else{
user.profileImg = req.body.NewImg;
res.redirect('/profile/');
}
}
});

Non compliant code

The application does not validate user input on the server side

app.post('/editProfile', isLoggedIn, function(req, res, next){
User.update({ _id: req.user.id}, req.body, function(err, user){
//Updating user image without validating data on the server side
user.profileImg = req.body.NewImg;

res.redirect('/profile/');
}
});

Requirements