Skip to content

Code Security Report: 12 high severity findings, 74 total findings [main] #52

@mend-developer-platform-dev

Description

@mend-developer-platform-dev

Code Security Report

Scan Metadata

Latest Scan: 2025-09-17 07:58AM
Total Findings: 74 | New Findings: 0 | Resolved Findings: 0
Tested Project Files: 31
Detected Programming Languages: 2 (Java*, JavaScript / TypeScript*)

Most Relevant Findings

The list below presents the 10 most relevant findings that need your attention.

Severity
Vulnerability Type
CWE
File
Data Flows
Detected
Violated Workflows
Violation Priority
Violation SLA
High
Command Injection
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

logger.info("Pinging: " + host);
try {
/* START EXAMPLE VULNERABILITY */
proc = Runtime.getRuntime().exec(new String[] { "bash", "-c", "ping -c1 " + host });
/* END EXAMPLE VULNERABILITY */
proc.waitFor(5, TimeUnit.SECONDS);
InputStreamReader isr = new InputStreamReader(proc.getInputStream());
BufferedReader br = new BufferedReader(isr);

Data Flows (1 detected)

public String tools(@RequestParam(value = "host", required = false) String host, @RequestParam(value = "fortunefile", required = false) String fortuneFile, Model model) {

model.addAttribute("ping", host != null ? ping(host) : "");


proc = Runtime.getRuntime().exec(new String[] { "bash", "-c", "ping -c1 " + host });

public String tools(@RequestParam(value = "host", required = false) String host, @RequestParam(value = "fortunefile", required = false) String fortuneFile, Model model) {

model.addAttribute("ping", host != null ? ping(host) : "");


proc = Runtime.getRuntime().exec(new String[] { "bash", "-c", "ping -c1 " + host });

Secure Code Warrior Training Material
High
Command Injection
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

String output = "";
Process proc;
try {
/* START EXAMPLE VULNERABILITY */
proc = Runtime.getRuntime().exec(new String[] { "bash", "-c", cmd });
/* END EXAMPLE VULNERABILITY */
proc.waitFor(5, TimeUnit.SECONDS);
InputStreamReader isr = new InputStreamReader(proc.getInputStream());
BufferedReader br = new BufferedReader(isr);

Data Flows (1 detected)

public String tools(@RequestParam(value = "host", required = false) String host, @RequestParam(value = "fortunefile", required = false) String fortuneFile, Model model) {

model.addAttribute("fortunes", fortune(fortuneFile));

private String fortune(String fortuneFile) {

String cmd = "/bin/fortune " + fortuneFile;

proc = Runtime.getRuntime().exec(new String[] { "bash", "-c", cmd });

public String tools(@RequestParam(value = "host", required = false) String host, @RequestParam(value = "fortunefile", required = false) String fortuneFile, Model model) {

model.addAttribute("fortunes", fortune(fortuneFile));

private String fortune(String fortuneFile) {

String cmd = "/bin/fortune " + fortuneFile;

proc = Runtime.getRuntime().exec(new String[] { "bash", "-c", cmd });

Secure Code Warrior Training Material
High
SQL Injection
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

connect = DriverManager.getConnection(Constants.create().getJdbcConnectionString());
// Find the Blabbers
logger.info(blabbersSql);
blabberQuery = connect.prepareStatement(blabbersSql);
blabberQuery.setString(1, username);
blabberQuery.setString(2, username);
ResultSet blabbersResults = blabberQuery.executeQuery();
/* END EXAMPLE VULNERABILITY */

Data Flows (1 detected)


String blabbersSql = "SELECT users.username," + " users.blab_name," + " users.created_at,"

blabberQuery = connect.prepareStatement(blabbersSql);


String blabbersSql = "SELECT users.username," + " users.blab_name," + " users.created_at,"

blabberQuery = connect.prepareStatement(blabbersSql);

Secure Code Warrior Training Material
High
SQL Injection
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

String sqlQuery = "select username, password, password_hint, created_at, last_login, real_name, blab_name from users where username='"
+ username + "' and password='" + md5(password) + "';";
sqlStatement = connect.createStatement();
logger.info("Execute the Statement");
ResultSet result = sqlStatement.executeQuery(sqlQuery);
/* END EXAMPLE VULNERABILITY */
// Did we find exactly 1 user that matched?
if (result.first()) {
logger.info("User Found.");

Data Flows (1 detected)


String sqlQuery = "select username, password, password_hint, created_at, last_login, real_name, blab_name from users where username='"

ResultSet result = sqlStatement.executeQuery(sqlQuery);


String sqlQuery = "select username, password, password_hint, created_at, last_login, real_name, blab_name from users where username='"

ResultSet result = sqlStatement.executeQuery(sqlQuery);

Secure Code Warrior Training Material
High
SQL Injection
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

String sql = "SELECT password_hint FROM users WHERE username = '" + username + "'";
logger.info(sql);
Statement statement = connect.createStatement();
ResultSet result = statement.executeQuery(sql);
if (result.first()) {
String password = result.getString("password_hint");
String formatString = "Username '" + username + "' has password: %.2s%s";
logger.info(formatString);
return String.format(

Data Flows (1 detected)

public String showPasswordHint(String username) {

String sql = "SELECT password_hint FROM users WHERE username = '" + username + "'";

ResultSet result = statement.executeQuery(sql);

public String showPasswordHint(String username) {

String sql = "SELECT password_hint FROM users WHERE username = '" + username + "'";

ResultSet result = statement.executeQuery(sql);

Secure Code Warrior Training Material
High
SQL Injection
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

Connection connect = DriverManager.getConnection(Constants.create().getJdbcConnectionString());
String sql = "SELECT username FROM users WHERE username = '" + username + "'";
Statement statement = connect.createStatement();
ResultSet result = statement.executeQuery(sql);
if (result.first()) {
model.addAttribute("error", "Username '" + username + "' already exists!");
return "register";
} else {
return "register-finish";

Data Flows (1 detected)


Utils.setSessionUserName(httpRequest, httpResponse, username);

public static void setSessionUserName(HttpServletRequest request, HttpServletResponse response, String value) {

Utils.setSessionUserName(httpRequest, httpResponse, username);

String sql = "SELECT username FROM users WHERE username = '" + username + "'";

ResultSet result = statement.executeQuery(sql);


Utils.setSessionUserName(httpRequest, httpResponse, username);

public static void setSessionUserName(HttpServletRequest request, HttpServletResponse response, String value) {

Utils.setSessionUserName(httpRequest, httpResponse, username);

String sql = "SELECT username FROM users WHERE username = '" + username + "'";

ResultSet result = statement.executeQuery(sql);

Secure Code Warrior Training Material
High
SQL Injection
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

query.append("'" + blabName + "'");
query.append(");");
sqlStatement = connect.createStatement();
sqlStatement.execute(query.toString());
logger.info(query.toString());
/* END EXAMPLE VULNERABILITY */
emailUser(username);
} catch (SQLException | ClassNotFoundException ex) {

Data Flows (1 detected)





Secure Code Warrior Training Material
High
Path/Directory Traversal
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

InputStream inputStream = null;
OutputStream outStream = null;
try {
File downloadFile = new File(path);
inputStream = new FileInputStream(downloadFile);
// get MIME type of the file
String mimeType = context.getMimeType(path);
if (mimeType == null) {
// set to binary type if MIME mapping not found

Data Flows (1 detected)


String path = context.getRealPath("/resources/images") + File.separator + imageName;


inputStream = new FileInputStream(downloadFile);


String path = context.getRealPath("/resources/images") + File.separator + imageName;


inputStream = new FileInputStream(downloadFile);

Secure Code Warrior Training Material
High
Unsafe Format String
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

if (result.first()) {
String password = result.getString("password_hint");
String formatString = "Username '" + username + "' has password: %.2s%s";
logger.info(formatString);
return String.format(
formatString,
password,
String.format("%0" + (password.length() - 2) + "d", 0).replace("0", "*"));
} else {
return "No password found for " + username;

Data Flows (1 detected)

public String showPasswordHint(String username) {

String formatString = "Username '" + username + "' has password: %.2s%s";

public String showPasswordHint(String username) {

String formatString = "Username '" + username + "' has password: %.2s%s";

Secure Code Warrior Training Material
High
Path/Directory Traversal
1
2025-09-17 07:59AM
Code Test
HIGH
2025-10-17
Vulnerable Code

String path = imageDir + username + extension;
logger.info("Saving new profile image: " + path);
file.transferTo(new File(path)); // will delete any existing file first
} catch (IllegalStateException | IOException ex) {
logger.error(ex);
}
}

Data Flows (1 detected)


String extension = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));

String path = imageDir + username + extension;

file.transferTo(new File(path)); // will delete any existing file first


String extension = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));

String path = imageDir + username + extension;

file.transferTo(new File(path)); // will delete any existing file first

Secure Code Warrior Training Material

Findings Overview

Severity Vulnerability Type CWE Language Count
High SQL Injection CWE-89 Java* 5
High Path/Directory Traversal CWE-22 Java* 3
High Command Injection CWE-78 Java* 2
High Cross-Site Scripting CWE-79 Java* 1
High Unsafe Format String CWE-134 Java* 1
Medium Error Messages Information Exposure CWE-209 Java* 9
Medium Unsafe Reflection CWE-470 Java* 1
Medium Trust Boundary Violation CWE-501 Java* 1
Low Log Forging CWE-117 Java* 22
Low System Properties Disclosure CWE-497 Java* 21
Low Unvalidated/Open Redirect CWE-601 Java* 3
Low HTTP Header Injection CWE-113 Java* 2
Low Weak Hash Strength CWE-328 Java* 2
Low Cookie Without 'HttpOnly' Flag CWE-1004 Java* 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions