Location Research Breakthrough Possible @S-Logix pro@slogix.in

CodeT5+-Driven SQL Injection False-Positive Reduction and Secure Query Remediation in OWASP Benchmark for Java Using SpotBugs and FindSecBugs

Description

Java applications commonly interact with databases to retrieve, insert, update, and delete application data. These operations frequently use SQL queries to process user input, application parameters, and database records.

SQL Injection is a security vulnerability that can occur when untrusted input is incorporated into an SQL query without appropriate handling. If an application constructs SQL statements through unsafe string concatenation, an attacker may influence the query's structure and potentially access or modify data without authorization.

Static Application Security Testing (SAST) tools, such as SpotBugs with FindSecBugs, can analyze Java source code or compiled application code to identify potential security weaknesses. However, a static-analysis finding does not always mean that a vulnerability is exploitable. Some findings may be false positives, while other findings require additional analysis to determine their actual security impact.

In this use case, OWASP Benchmark for Java is used as the target application for evaluating SQL Injection-related security findings. SpotBugs and FindSecBugs are used to identify potential SQL Injection weaknesses through static analysis.

A CodeT5+ model is incorporated into the analysis workflow to examine relevant Java code, SQL query construction, user-input handling, and static-analysis findings. The model assists in classifying findings as potential vulnerabilities, false positives, or findings that require further validation.

Python is used to process the static-analysis results, prepare the information required by the model, evaluate classification performance, and organize the results for presentation through a dashboard. The dashboard presents the detected findings, model-assisted classifications, validation status, and remediation recommendations.

Controlled SQL Injection test cases are evaluated within the authorized OWASP Benchmark for Java environment. The results are compared against the expected vulnerability status to assess whether the model can help reduce false-positive findings without incorrectly dismissing genuine vulnerabilities.

For findings confirmed as vulnerable, secure query remediation recommendations are generated using parameterized queries and appropriate input-handling practices. The application is then reassessed to determine whether the identified weaknesses have been addressed.

Publicly available labeled data is used to support model evaluation and classification assessment. The data is processed for the experiment rather than being treated as proof that every new application finding is exploitable.

The complete security-validation workflow is:
OWASP Benchmark for Java
→
Java Code Analysis
→
SpotBugs and FindSecBugs
→
SQL Injection Findings
→
CodeT5+ Classification
→
False-Positive Assessment
→
Controlled Vulnerability Validation
→
Secure Query Remediation
→
Post-Remediation Testing
→
Python Dashboard
→
Security Evaluation

Existing Security Problem

Application/Service: OWASP Benchmark for Java

OWASP Benchmark for Java is the target application used to evaluate the detection and classification of security weaknesses in Java code. It provides test cases that can support the assessment of application security testing tools.

Existing Problem :

Static-analysis tools can identify code patterns associated with SQL Injection, but their findings require appropriate interpretation and validation.

A finding may be incorrectly classified as a vulnerability when the relevant code does not present the suspected security condition. Conversely, an actual SQL Injection weakness may be missed or incorrectly dismissed if the code context is not adequately examined.

Manual validation of numerous findings can also require considerable time. When findings are not correctly classified, security teams may spend time investigating false positives or overlook genuine vulnerabilities.

The security problem is:
Java Application
→
Database Query Construction
→
User Input Handling
→
Potentially Unsafe SQL Query
→
Static Analysis Using SpotBugs and FindSecBugs
→
Potential SQL Injection Findings
→
False Positives and Genuine Vulnerabilities
→
Manual Finding Validation
→
Security Analysis Effort
→
Need for Improved Finding Classification
→
Secure Query Remediation
→
Post-Remediation Validation

The proposed solution introduces CodeT5+-assisted analysis of Java code and static-analysis findings, false-positive classification, controlled vulnerability validation, secure query remediation, and post-remediation testing.

Attack

Specific Attack: SQL Injection Attack

The controlled attack scenario evaluates SQL Injection test cases in the authorized OWASP Benchmark for Java environment.

The assessment focuses on whether untrusted input can influence SQL query

construction in a way that changes the intended query behavior.

SpotBugs and FindSecBugs are used to identify potential SQL Injection weaknesses. CodeT5+ assists in interpreting the relevant code context and classifying the findings. Controlled test cases are then used to evaluate the classification results against the expected vulnerability status.

Only the designated laboratory application and its test data are used. Testing is not performed against production databases or unauthorized systems.

Attack Behavior :
User-Controlled Input
→
Java Application Input Handling
→
SQL Query Construction
→
Potentially Unsafe Query Formation
→
SQL Injection Test Case
→
Database Query Processing
→
Potential Unauthorized Query Behavior
→
Static Analysis and Finding Collection
→
CodeT5+-Assisted Finding Classification
→
Controlled Vulnerability Validation
→
Secure Query Remediation
→
Post-Remediation Testing

Security Concept

AI-Assisted Static Application Security Testing and SQL Injection False-Positive Reduction

The primary security concept is AI-assisted static application security testing combined with vulnerability validation and secure query remediation.

Static analysis examines Java application code to identify patterns associated with SQL Injection. SpotBugs and FindSecBugs provide the initial findings, while CodeT5+ analyzes relevant code context to assist in classifying the findings and reducing unnecessary false-positive investigations.

The model's classification is not treated as definitive proof that a finding is exploitable or harmless. The classification is evaluated against the expected status of the benchmark test cases and, where necessary, supported by controlled validation.

For findings confirmed as vulnerable, secure query remediation focuses on separating SQL query structure from user-supplied values. Parameterized queries are used where appropriate to prevent input values from being interpreted as SQL syntax.

Python supports the integration of static-analysis results, model-assisted classification, evaluation metrics, and dashboard presentation. The dashboard helps security analysts review findings, understand their classification, and track remediation status.

The assessment follows:
Java Application Review
→
Static Code Analysis
→
SQL Injection Finding Collection
→
Java Code Context Extraction
→
CodeT5+ Finding Classification
→
False-Positive and True-Positive Evaluation
→
Controlled Vulnerability Validation
→
Finding Prioritization
→
Secure Query Remediation
→
Post-Remediation Testing
→
Classification and Remediation Evaluation
→
Security Dashboard

Defensive Mechanism

The security concept defines the overall security strategy.

The following are the specific defensive mechanisms implemented.

Static Analysis-Based Detection :

SpotBugs and FindSecBugs analyze the Java application to identify potential SQL Injection weaknesses.

Purpose: Identify suspicious SQL query construction and potential injection-related code patterns.

AI-Assisted Finding Classification

CodeT5+ examines the relevant Java code context and static-analysis findings to assist in distinguishing likely vulnerabilities from false positives.

Purpose
  • Reduce unnecessary false-positive investigations while preserving genuine security findings for validation.

Controlled Vulnerability Validation

The classification results are compared against the expected status of the benchmark test cases and supported by controlled testing where appropriate.

Purpose
  • Determine whether the identified security findings correspond to the actual behavior of the tested application.

Parameterized Query Implementation

Confirmed SQL Injection weaknesses are addressed by separating SQL query structure from user-supplied values through parameterized queries.

Purpose
  • Prevent untrusted input from changing the intended SQL query structure.

Input Handling Review

Java input-handling logic is reviewed to determine whether untrusted values are processed appropriately before they are used in database operations.

Purpose
  • Reduce the risk of unsafe input processing within database-related application functions.

Model Evaluation

The model-assisted classifications are compared with the expected labels using suitable classification metrics.

Purpose
  • Measure classification performance and determine whether false positives are reduced without an unacceptable loss of genuine vulnerability detections.

Finding Prioritization

Validated findings are prioritized according to their security impact, affected code, and validation results.

Purpose
  • Direct remediation efforts toward confirmed and higher-priority SQL Injection weaknesses.

Post-Remediation Validation

The affected test cases are reassessed after secure query changes have been implemented.

Purpose
  • Verify that the identified SQL Injection weaknesses have been addressed without unnecessarily breaking legitimate application functionality.

Security Dashboard

Python processes and presents the findings, classifications, evaluation results, and remediation status.

Purpose
  • Provide a consolidated view of the SQL Injection assessment and its results.

Security Tools

Primary Static Analysis Tool: SpotBugs

SpotBugs analyzes Java bytecode to identify potential defects and suspicious code patterns. It provides the static-analysis foundation for collecting findings from the Java application.

Purpose
  • Analyze Java application bytecode.
  • Identify potential code defects.
  • Support the initial security-analysis workflow.
  • Provide findings for further investigation.

Security Analysis Plugin: FindSecBugs

FindSecBugs extends SpotBugs with security-focused bug detectors, including detectors associated with SQL Injection.

Purpose
  • Identify potential SQL Injection weaknesses.
  • Detect suspicious database query construction.
  • Support security-finding collection.
  • Provide findings for AI-assisted classification.

AI Code Analysis Model: CodeT5+

CodeT5+ is an encoder-decoder model designed for code-related tasks. In this use case, it is used to assist with classification of SQL Injection-related findings based on relevant Java code context and static-analysis information.

Purpose
  • Analyze relevant Java code context.
  • Assist in classifying potential SQL Injection findings.
  • Support false-positive assessment.
  • Produce classification results for evaluation.

Target Application: OWASP Benchmark for Java

OWASP Benchmark for Java provides the Java application and test cases used to evaluate SQL Injection detection and classification.

Purpose
  • Provide an authorized application-testing environment.
  • Supply relevant Java security test cases.
  • Support controlled vulnerability validation.
  • Evaluate the classification workflow.

Programming and Integration Tool: Python

Python is used to integrate static-analysis results, prepare model inputs, evaluate classification performance, and process results for presentation.

Purpose
  • Parse and organize static-analysis findings.
  • Prepare code and finding information for model analysis.
  • Calculate classification metrics.
  • Generate structured results for the dashboard.

Evaluation Data: Publicly Available Labeled Data

Publicly available labeled data is used to support the evaluation of the classification approach. Its labels and suitability must be checked before the data is used.

Purpose
  • Support model evaluation.
  • Provide labeled examples for classification assessment.
  • Compare predicted classifications with reference labels.
  • Help measure false-positive reduction and vulnerability-detection performance.

Database Platform: Database Used by the Benchmark Environment

The database configured for the authorized benchmark environment supports execution of the relevant application test cases.

Purpose
  • Support database-related application operations.
  • Execute the benchmark's designated SQL queries.
  • Support controlled testing of relevant SQL Injection cases.
  • Verify expected application behavior after remediation.

Dashboard Framework: Streamlit

Streamlit is used to build a Python-based dashboard for presenting the assessment results.

Purpose
  • Display collected SQL Injection findings.
  • Present model-assisted classifications.
  • Show evaluation metrics.
  • Track finding validation and remediation status

Development and Testing Platform: Ubuntu Linux

Ubuntu provides the development and testing environment for the Java application, analysis tools, Python integration, and dashboard.

Purpose
  • Host the application-testing environment.
  • Support Java and Python development.
  • Run the security-analysis workflow.
  • Store assessment results and evidence.

Security Testing Platform: Kali Linux

Kali Linux can be used as the separate security-testing environment where the laboratory design requires it. The primary static-analysis and model-classification workflow runs in the configured development environment.

Purpose
  • Provide a separate environment for authorized security testing where required.
  • Support controlled connectivity and testing.
  • Help keep assessment activities isolated from production systems.

Virtualization Platform: VirtualBox

VirtualBox provides isolated virtual machines for the laboratory environment.

Purpose
  • Host Ubuntu and Kali Linux virtual machines where required.
  • Separate the testing environment from production infrastructure.
  • Support controlled laboratory networking.
  • Provide a reproducible environment for security testing.

Process

STEP 01

Prepare the Isolated Security Testing Environment

  • Prepare the authorized laboratory using VirtualBox.
  • Configure Ubuntu as the primary development and application-testing environment.
  • Configure Kali Linux separately if required for controlled security testing.
  • Verify that the laboratory environment is isolated from production systems.
  • Install the required Java and Python development components.
  • Confirm that the necessary system resources are available.
  • Record the initial laboratory configuration.
Tools: VirtualBox + Ubuntu + Kali Linux
STEP 02

Prepare the OWASP Benchmark for Java Application

  • Obtain the OWASP Benchmark for Java project from its official repository.
  • Review the project structure and available security test cases.
  • Identify the SQL Injection-related test cases relevant to the use case.
  • Configure the required Java development environment.
  • Build the application according to its documented requirements.
  • Start the application in the isolated laboratory.
  • Verify that the application is functioning as expected.
  • Record the initial application configuration.
Tools: OWASP Benchmark for Java + Java Development Kit + Maven + Ubuntu
STEP 03

Configure the Application's Database Environment

  • Review the database requirements of the benchmark application.
  • Configure the database required by the selected test cases.
  • Verify database connectivity from the Java application.
  • Confirm that the application can execute its normal database operations.
  • Identify the relevant SQL query-handling code.
  • Record the database configuration used for the assessment.
  • Confirm that the test environment does not contain production data.
Tools: OWASP Benchmark for Java + Configured Database + Java Development Kit + Ubuntu
STEP 04

Establish the Initial Application Security Baseline

  • Identify the SQL Injection-related benchmark test cases.
  • Record their expected vulnerability status using the benchmark's documented information.
  • Identify the corresponding Java source-code locations.
  • Review how the selected test cases handle user-controlled input
  • Identify the database query construction methods used by the relevant code.
  • Confirm that the initial application state is recorded before remediation.
  • Preserve the baseline information for later comparison.
Tools: OWASP Benchmark for Java + Java Source Code + Ubuntu
STEP 05

Configure SpotBugs and FindSecBugs

  • Configure SpotBugs in the Java project.
  • Add and configure FindSecBugs according to its documented integration requirements.
  • Verify that the security-analysis plugin is available.
  • Configure the analysis to cover the relevant application code.
  • Build the Java application if required by the selected analysis configuration.
  • Execute the initial static-analysis scan.
  • Collect the reported security findings.
  • Preserve the scan results for further processing.
Tools: SpotBugs + FindSecBugs + Maven + Ubuntu
STEP 06

Collect SQL Injection-Related Findings

  • Review the static-analysis results.
  • Identify findings associated with SQL Injection.
  • Extract the relevant finding identifiers and descriptions.
  • Record the affected classes and methods where available.
  • Identify the relevant source-code locations.
  • Preserve the original analysis severity and detector information.
  • Separate the SQL Injection-related findings from unrelated findings.
  • Store the collected results in a structured format.
Tools: SpotBugs + FindSecBugs + Python + Ubuntu
STEP 07

Prepare the Java Code Context for Classification

  • Read the Java source code associated with each selected finding.
  • Extract the relevant query construction and input-handling logic.
  • Collect the corresponding static-analysis descriptions.
  • Include sufficient surrounding code to support contextual interpretation.
  • Remove unnecessary information that is unrelated to the finding.
  • Associate each finding with its corresponding benchmark test case where possible.
  • Prepare the structured input required by the classification workflow.
  • Preserve the original findings separately for comparison.
Tools: Python + Java Source Code + SpotBugs + FindSecBugs
STEP 08

Prepare the Public Labeled Evaluation Data

  • Obtain suitable publicly available labeled data for the evaluation task.
  • Review the data's documentation and permitted usage.
  • Examine the available labels and their meanings.
  • Identify the information required for the classification experiment.
  • Check for missing, inconsistent, or duplicate records.
  • Prepare the data in a consistent format for evaluation.
  • Separate evaluation examples appropriately to reduce data leakage.
  • Record the data-preparation procedure.
Tools: Python + Publicly Available Labeled Data
STEP 09

Configure CodeT5+ for Finding Classification

  • Obtain the CodeT5+ model and its required dependencies.
  • Review the model's supported input format and execution requirements.
  • Configure the model in the authorized development environment.
  • Prepare the code and finding information for model input.
  • Define the classification labels used by the experiment.
  • Configure the inference workflow to produce structured classification results.
  • Verify that the model can process representative inputs.
  • Record the model configuration used in the experiment.
Tools: CodeT5+ + Python + Ubuntu
STEP 10

Perform AI-Assisted SQL Injection Classification

  • Provide the prepared Java code context and static-analysis information to CodeT5+.
  • Process each selected finding using the configured classification workflow.
  • Collect the model's predicted classification.
  • Associate each prediction with its original finding identifier.
  • Preserve the relevant code context and original static-analysis result.
  • Record cases that cannot be classified confidently.
  • Avoid treating model predictions as confirmed vulnerability results.
  • Store the classification output for validation.
Tools: CodeT5+ + Python + SpotBugs + FindSecBugs
STEP 11

Evaluate the Classification Results

  • Compare model predictions with the expected labels available for the evaluation examples.
  • Identify correctly classified genuine vulnerabilities.
  • Identify genuine vulnerabilities incorrectly classified as false positives.
  • Identify false positives correctly classified by the model.
  • Identify false positives incorrectly classified as vulnerabilities.
  • Calculate precision, recall, F1-score, and other suitable classification metrics.
  • Calculate the false-positive rate where the reference labels support the calculation.
  • Compare the AI-assisted results with the original static-analysis results.
  • Record the evaluation results for later reporting.
Tools: Python + CodeT5+ + Publicly Available Labeled Data
STEP 12

Perform Controlled SQL Injection Validation

  • Select the relevant SQL Injection test cases in the authorized benchmark application.
  • Review the expected behavior of each selected test case.
  • Examine the corresponding Java query construction and input-handling logic.
  • Execute the designated benchmark tests using the documented procedure.
  • Observe whether the test case produces its expected result.
  • Compare the observed behavior with the static-analysis finding and model classification.
  • Investigate discrepancies between the expected status and the model prediction.
  • Record the evidence supporting the final validation status.
Tools: OWASP Benchmark for Java + SpotBugs + FindSecBugs + Python
STEP 13

Document and Prioritize the Validated Findings

  • Organize the findings according to their validation status.
  • Identify confirmed vulnerabilities and findings requiring further review.
  • Identify false positives supported by the available evidence.
  • Record the affected Java classes and methods.
  • Review the potential security impact of each confirmed vulnerability.
  • Prioritize remediation according to the vulnerability's impact and context.
  • Record the model classification separately from the final validation result.
  • Prepare a structured report of the findings and their evidence
Tools: Python + SpotBugs + FindSecBugs + OWASP Benchmark for Java
STEP 14

Develop the Secure Query Remediation Strategy

  • Review the Java code associated with each confirmed SQL Injection weakness.
  • Identify unsafe query construction and input-handling patterns.
  • Determine whether parameterized queries can be used for the affected database operation.
  • Identify the appropriate database API for parameterized query execution.
  • Define the necessary code changes.
  • Ensure that user-supplied values are handled as data rather than SQL syntax.
  • Review whether the proposed change preserves the application's intended functionality.
  • Record the remediation plan before implementing the changes
Tools: Java Source Code + Python + OWASP Benchmark for Java
STEP 15

Implement Secure Query Remediation

  • Update the affected Java code according to the approved remediation plan.
  • Replace unsafe SQL string concatenation with parameterized queries where applicable.
  • Ensure that user-controlled values are passed through the appropriate query parameters.
  • Preserve the intended database operation.
  • Review relevant exception-handling behavior.
  • Build the modified application.
  • Resolve compilation errors introduced by the changes.
  • Run the relevant functional tests.
  • Record the changes made to address each confirmed finding.
Tools: Java Development Kit + Maven + OWASP Benchmark for Java + Ubuntu
STEP 16

Perform Post-Remediation Security Testing

  • Execute SpotBugs and FindSecBugs against the updated application.
  • Collect the new static-analysis findings.
  • Compare the updated results with the original scan.
  • Execute the relevant benchmark test cases again.
  • Verify that the remediated test cases exhibit their expected behavior.
  • Check whether the original SQL Injection-related findings remain.
  • Investigate any remaining findings rather than automatically treating them as vulnerabilities.
  • Record the post-remediation test results.
Tools: SpotBugs + FindSecBugs + OWASP Benchmark for Java + Maven
STEP 17

Integrate the Results into the Python Dashboard

  • Prepare the original static-analysis results in a structured format.
  • Import the CodeT5+ classification results.
  • Include the expected labels and evaluation metrics where available.
  • Integrate the controlled validation results.
  • Record the remediation status for each relevant finding.
  • Develop dashboard views for findings, classifications, and validation outcomes.
  • Display suitable classification metrics and the original-versus-AI-assisted comparison.
  • Include the post-remediation results.
  • Verify that the dashboard presents the stored results correctly
Tools: Python + Streamlit + CodeT5+ + SpotBugs + FindSecBugs
STEP 18

Perform Final Security Validation and Evaluation

  • Review the initial static-analysis results.
  • Review the CodeT5+ classification output.
  • Review the expected labels and classification metrics.
  • Compare the original and AI-assisted false-positive results.
  • Review the controlled SQL Injection validation evidence.
  • Review the secure query changes implemented in the Java application.
  • Examine the post-remediation static-analysis results.
  • Confirm the final validation status of the selected test cases.
  • Review the dashboard for consistency with the recorded assessment results.
  • Document unresolved findings and limitations of the classification approach.
  • Finalize the security assessment report.
Tools: Python + Streamlit + CodeT5+ + SpotBugs + FindSecBugs + OWASP Benchmark for Java

Outcome

The OWASP Benchmark for Java application is deployed in an isolated testing environment to support the controlled assessment of SQL Injection-related security findings.

SpotBugs and FindSecBugs identify potential SQL Injection weaknesses, providing the initial static-analysis results for the classification and validation workflow.

Java code context and static-analysis information are processed using CodeT5+ to assist in classifying potential vulnerabilities, false positives, and findings requiring further investigation.

Publicly available labeled data and benchmark test-case information are used, where appropriate, to evaluate the classification approach against reference labels.

Classification metrics, including precision, recall, F1-score, and false-positive rate where applicable, are calculated to assess the effectiveness of the AI-assisted approach.

Controlled SQL Injection validation is performed against the authorized benchmark environment to compare the expected vulnerability status with the static-analysis findings and model predictions.

Confirmed SQL Injection weaknesses are addressed through secure query remediation, including parameterized queries where applicable, reducing the risk of user-controlled input altering SQL query structure.

Post-remediation static analysis and benchmark testing are performed to assess whether the identified weaknesses have been addressed and whether legitimate application functionality remains operational.

A Python-based dashboard presents the collected findings, AI-assisted classifications, evaluation metrics, validation results, and remediation status in a consolidated view for security assessment.

The complete workflow—from static analysis and CodeT5+-assisted false-positive assessment to controlled validation, secure query remediation, post-remediation testing, and dashboard-based evaluation—is demonstrated, with the results documenting both the benefits and limitations of the proposed approach.