Skip to main content

Insecure temporary files

Description

The system uses temporary files to store sensitive information. Alternatively, the system deploys sensitive temporary files to the production environment.

Impact

Steal server secrets.

Recommendation

Avoid saving sensitive information in server files.

Threat

Authenticated attacker with local access to the server.

Expected Remediation Time

⌚ 30 minutes.

Score

Default score using CVSS 3.1. It may change depending on the context of the vulnerability.

Base

  • Attack vector: L
  • Attack complexity: L
  • Privileges required: H
  • 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:L/AC:L/PR:H/UI:N/S:U/C:L/I:N/A:N/E:P/RL:X/RC:R
  • Score:
    • Base: 2.3
    • Temporal: 2.1
  • Severity:
    • Base: Low
    • Temporal: Low

Code Examples

Compliant code

Sensitive data should always be stored encrypted and without the use of temporary files

import java.io.File;

public class Test {
public static void main(String[] args){
try {
encryptedHash = encryptInfo(credentials);
addUser(user, encryptedHash);
} catch (Exception e) {
...
}
}
}

Non compliant code

The application uses temp files to store credentials

import java.io.File;

public class Test {
public static void main(String[] args){
try {
file = File.createTempFile(credentials, null));
uploadFile(file)
} catch (Exception e) {
...
}
}
}

Requirements

free trial

Search for vulnerabilities in your apps for free with our automated security testing! Start your 21-day free trial and discover the benefits of our Continuous Hacking Machine Plan. If you prefer a full service that includes the expertise of our ethical hackers, don't hesitate to contact us for our Continuous Hacking Squad Plan.