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) {
...
}
}
}