-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Code Security Report
Scan Metadata
Latest Scan: 2025-01-30 08:59am
Total Findings: 34 | New Findings: 0 | Resolved Findings: 0
Tested Project Files: 412
Detected Programming Languages: 2 (JavaScript / TypeScript*, Java*)
- Check this box to manually trigger a scan
Most Relevant Findings
The list below presents the 10 most relevant findings that need your attention. To view information on the remaining findings, navigate to the Mend SAST Application.
| Severity | Vulnerability Type | CWE | File | Data Flows | Detected | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| SQL Injection | 2 | 2025-01-08 11:32am | |||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| String logQuery = "INSERT INTO access_log (time, action) VALUES ('" + time + "', '" + action + "')"; | |
| try { | |
| Statement statement = connection.createStatement(TYPE_SCROLL_SENSITIVE, CONCUR_UPDATABLE); | |
| statement.executeUpdate(logQuery); |
2 Data Flow/s detected
View Data Flow 1
Line 54 in 9834156
| public AttackResult completed(@RequestParam String name, @RequestParam String auth_tan) { |
Line 55 in 9834156
| return injectableQueryConfidentiality(name, auth_tan); |
Line 58 in 9834156
| protected AttackResult injectableQueryConfidentiality(String name, String auth_tan) { |
Line 60 in 9834156
| String query = "SELECT * FROM employees WHERE last_name = '" + name + "' AND auth_tan = '" + auth_tan + "'"; |
Line 65 in 9834156
| log(connection, query); |
Line 128 in 9834156
| public static void log(Connection connection, String action) { |
Line 129 in 9834156
| action = action.replace('\'', '"'); |
Line 134 in 9834156
| String logQuery = "INSERT INTO access_log (time, action) VALUES ('" + time + "', '" + action + "')"; |
Line 138 in 9834156
| statement.executeUpdate(logQuery); |
View Data Flow 2
Line 55 in 9834156
| public AttackResult completed(@RequestParam String name, @RequestParam String auth_tan) { |
Line 56 in 9834156
| return injectableQueryIntegrity(name, auth_tan); |
Line 59 in 9834156
| protected AttackResult injectableQueryIntegrity(String name, String auth_tan) { |
Line 61 in 9834156
| String query = "SELECT * FROM employees WHERE last_name = '" + name + "' AND auth_tan = '" + auth_tan + "'"; |
Line 65 in 9834156
| SqlInjectionLesson8.log(connection, query); |
Line 128 in 9834156
| public static void log(Connection connection, String action) { |
Line 129 in 9834156
| action = action.replace('\'', '"'); |
Line 134 in 9834156
| String logQuery = "INSERT INTO access_log (time, action) VALUES ('" + time + "', '" + action + "')"; |
Line 138 in 9834156
| statement.executeUpdate(logQuery); |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior SQL Injection Training
● Videos
▪ Secure Code Warrior SQL Injection Video
● Further Reading
Vulnerable Code
Lines 57 to 62 in 9834156
| protected AttackResult injectableQuery(String accountName) { | |
| String query = ""; | |
| try (Connection connection = dataSource.getConnection()) { | |
| query = "SELECT * FROM user_data WHERE first_name = 'John' and last_name = '" + accountName + "'"; | |
| try (Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)) { | |
| ResultSet results = statement.executeQuery(query); |
1 Data Flow/s detected
Line 53 in 9834156
| public AttackResult completed(@RequestParam String account, @RequestParam String operator, @RequestParam String injection) { |
Line 54 in 9834156
| return injectableQuery(account + " " + operator + " " + injection); |
Line 57 in 9834156
| protected AttackResult injectableQuery(String accountName) { |
Line 60 in 9834156
| query = "SELECT * FROM user_data WHERE first_name = 'John' and last_name = '" + accountName + "'"; |
Line 62 in 9834156
| ResultSet results = statement.executeQuery(query); |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior SQL Injection Training
● Videos
▪ Secure Code Warrior SQL Injection Video
● Further Reading
Vulnerable Code
Lines 55 to 60 in 9834156
| } | |
| if (!"Larry".equals(username_login)) { | |
| return failed(this).feedback("user.not.larry").feedbackArgs(username_login).build(); | |
| } | |
| try (var connection = dataSource.getConnection()) { | |
| PreparedStatement statement = connection.prepareStatement("select password from challenge_users where userid = '" + username_login + "' and password = '" + password_login + "'"); |
1 Data Flow/s detected
Line 52 in 9834156
| public AttackResult login(@RequestParam String username_login, @RequestParam String password_login) throws Exception { |
Line 60 in 9834156
| PreparedStatement statement = connection.prepareStatement("select password from challenge_users where userid = '" + username_login + "' and password = '" + password_login + "'"); |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior SQL Injection Training
● Videos
▪ Secure Code Warrior SQL Injection Video
● Further Reading
Vulnerable Code
Lines 42 to 47 in 9834156
| try { | |
| uploadDirectory.mkdirs(); | |
| var uploadedFile = new File(uploadDirectory, fullName); | |
| uploadedFile.createNewFile(); | |
| FileCopyUtils.copy(file.getBytes(), uploadedFile); |
3 Data Flow/s detected
View Data Flow 1
Line 28 in 9834156
| public AttackResult uploadFileHandler(@RequestParam("uploadedFile") MultipartFile file, @RequestParam(value = "fullName", required = false) String fullName) { |
Line 29 in 9834156
| return super.execute(file, fullName); |
Line 30 in 9834156
| protected AttackResult execute(MultipartFile file, String fullName) { |
Line 47 in 9834156
| FileCopyUtils.copy(file.getBytes(), uploadedFile); |
View Data Flow 2
Line 26 in 9834156
| public AttackResult uploadFileHandler(@RequestParam("uploadedFileRemoveUserInput") MultipartFile file) { |
Line 27 in 9834156
| return super.execute(file, file.getOriginalFilename()); |
Line 30 in 9834156
| protected AttackResult execute(MultipartFile file, String fullName) { |
Line 47 in 9834156
| FileCopyUtils.copy(file.getBytes(), uploadedFile); |
View Data Flow 3
Line 28 in 9834156
| public AttackResult uploadFileHandler( |
Line 31 in 9834156
| return super.execute(file, fullName != null ? fullName.replace("../", "") : ""); |
Line 30 in 9834156
| protected AttackResult execute(MultipartFile file, String fullName) { |
Line 47 in 9834156
| FileCopyUtils.copy(file.getBytes(), uploadedFile); |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior Path/Directory Traversal Training
● Videos
▪ Secure Code Warrior Path/Directory Traversal Video
● Further Reading
Vulnerable Code
WebGoat/webgoat-lessons/ssrf/src/main/java/org/owasp/webgoat/ssrf/SSRFTask2.java
Lines 48 to 53 in 9834156
| } | |
| protected AttackResult furBall(String url) { | |
| if (url.matches("http://ifconfig.pro")) { | |
| String html; | |
| try (InputStream in = new URL(url).openStream()) { |
1 Data Flow/s detected
| public AttackResult completed(@RequestParam String url) { |
| return furBall(url); |
| protected AttackResult furBall(String url) { |
| try (InputStream in = new URL(url).openStream()) { |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior Server Side Request Forgery Training
● Videos
Vulnerable Code
Lines 88 to 93 in 9834156
| if (catPicture.getName().toLowerCase().contains("path-traversal-secret.jpg")) { | |
| return ResponseEntity.ok() | |
| .contentType(MediaType.parseMediaType(MediaType.IMAGE_JPEG_VALUE)) | |
| .body(FileCopyUtils.copyToByteArray(catPicture)); | |
| } | |
| if (catPicture.exists()) { |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior Path/Directory Traversal Training
● Videos
▪ Secure Code Warrior Path/Directory Traversal Video
● Further Reading
Vulnerable Code
Lines 51 to 56 in 9834156
| b64token = token.replace('-', '+').replace('_', '/'); | |
| try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(b64token)))) { | |
| before = System.currentTimeMillis(); | |
| Object o = ois.readObject(); |
1 Data Flow/s detected
Line 46 in 9834156
| public AttackResult completed(@RequestParam String token) throws IOException { |
Line 52 in 9834156
| b64token = token.replace('-', '+').replace('_', '/'); |
Line 54 in 9834156
| try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(b64token)))) { |
Line 56 in 9834156
| Object o = ois.readObject(); |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior Deserialization of Untrusted Data Training
● Videos
▪ Secure Code Warrior Deserialization of Untrusted Data Video
● Further Reading
▪ OWASP Deserialization Cheat Sheet
Vulnerable Code
Lines 62 to 67 in 9834156
| if (!accountName.matches("(?i)(^[^-/*;)]*)(\\s*)UNION(.*$)")) { | |
| usedUnion = false; | |
| } | |
| try (Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, | |
| ResultSet.CONCUR_READ_ONLY)) { | |
| ResultSet results = statement.executeQuery(query); |
3 Data Flow/s detected
View Data Flow 1
Line 51 in 9834156
| public AttackResult completed(@RequestParam String userid_6a) { |
Line 52 in 9834156
| return injectableQuery(userid_6a); |
Line 56 in 9834156
| public AttackResult injectableQuery(String accountName) { |
Line 60 in 9834156
| query = "SELECT * FROM user_data WHERE last_name = '" + accountName + "'"; |
Line 67 in 9834156
| ResultSet results = statement.executeQuery(query); |
View Data Flow 2
Line 48 in 9834156
| public AttackResult attack(@RequestParam("userid_sql_only_input_validation") String userId) { |
Line 52 in 9834156
| AttackResult attackResult = lesson6a.injectableQuery(userId); |
Line 56 in 9834156
| public AttackResult injectableQuery(String accountName) { |
Line 60 in 9834156
| query = "SELECT * FROM user_data WHERE last_name = '" + accountName + "'"; |
Line 67 in 9834156
| ResultSet results = statement.executeQuery(query); |
View Data Flow 3
Line 48 in 9834156
| public AttackResult attack(@RequestParam("userid_sql_only_input_validation_on_keywords") String userId) { |
Line 49 in 9834156
| userId = userId.toUpperCase().replace("FROM", "").replace("SELECT", ""); |
Line 53 in 9834156
| AttackResult attackResult = lesson6a.injectableQuery(userId); |
Line 56 in 9834156
| public AttackResult injectableQuery(String accountName) { |
Line 60 in 9834156
| query = "SELECT * FROM user_data WHERE last_name = '" + accountName + "'"; |
Line 67 in 9834156
| ResultSet results = statement.executeQuery(query); |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior SQL Injection Training
● Videos
▪ Secure Code Warrior SQL Injection Video
● Further Reading
Vulnerable Code
Lines 49 to 54 in 9834156
| Files.createDirectories(uploadDirectory.toPath()); | |
| try { | |
| var uploadedZipFile = tmpZipDirectory.resolve(file.getOriginalFilename()); | |
| FileCopyUtils.copy(file.getBytes(), uploadedZipFile.toFile()); |
2 Data Flow/s detected
View Data Flow 1
Line 36 in 9834156
| public AttackResult uploadFileHandler(@RequestParam("uploadedFileZipSlip") MultipartFile file) { |
Line 40 in 9834156
| return processZipUpload(file); |
Line 45 in 9834156
| private AttackResult processZipUpload(MultipartFile file) { |
Line 54 in 9834156
| FileCopyUtils.copy(file.getBytes(), uploadedZipFile.toFile()); |
View Data Flow 2
Line 36 in 9834156
| public AttackResult uploadFileHandler(@RequestParam("uploadedFileZipSlip") MultipartFile file) { |
Line 40 in 9834156
| return processZipUpload(file); |
Line 45 in 9834156
| private AttackResult processZipUpload(MultipartFile file) { |
Line 53 in 9834156
| var uploadedZipFile = tmpZipDirectory.resolve(file.getOriginalFilename()); |
Line 54 in 9834156
| FileCopyUtils.copy(file.getBytes(), uploadedZipFile.toFile()); |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior Path/Directory Traversal Training
● Videos
▪ Secure Code Warrior Path/Directory Traversal Video
● Further Reading
Vulnerable Code
Lines 47 to 52 in 9834156
| try { | |
| if (!StringUtils.isEmpty(payload)) { | |
| payload = payload.replace("+", "").replace("\r", "").replace("\n", "").replace("> ", ">").replace(" <", "<"); | |
| } | |
| contact = (Contact) xstream.fromXML(payload); |
Secure Code Warrior Training Material
● Training
▪ Secure Code Warrior Deserialization of Untrusted Data Training
● Videos
▪ Secure Code Warrior Deserialization of Untrusted Data Video
● Further Reading
▪ OWASP Deserialization Cheat Sheet
Findings Overview
| Severity | Vulnerability Type | CWE | Language | Count |
|---|---|---|---|---|
| SQL Injection | CWE-89 | Java* | 14 | |
| Deserialization of Untrusted Data | CWE-502 | Java* | 2 | |
| Path/Directory Traversal | CWE-22 | Java* | 7 | |
| Server Side Request Forgery | CWE-918 | Java* | 2 | |
| XML External Entity (XXE) Injection | CWE-611 | Java* | 1 | |
| Error Messages Information Exposure | CWE-209 | Java* | 5 | |
| System Properties Disclosure | CWE-497 | Java* | 1 | |
| Weak Hash Strength | CWE-328 | Java* | 1 | |
| Log Forging | CWE-117 | Java* | 1 |