Security Vulnerabilities in Java Based Applications
Security Vulnerabilities in Java Based Applications
-By Sivareddy
Below are the security vulnerabilities often found in Java based Applications
and will have high impact and severity on the application reliability.
1) SQL Injection
2) Unclosed Resources/Memory leaks
3) Directory Traversal Attack/Malicious File uploads :
4) Cross site Scripting
5) Password Management(logging, hard coding, weak
password)
6) Poor Logging
7) Improper Exception Handling
8) Improper validations on user inputs
1) SQL Injection : Inject malicious SQL statements in user input
What is the Impact?
An attacker can inject malicious SQL code in the user input
An Attacker can view sensitive data stored in the database
An Attacker can bypass the authentication/authorization check
An Attacker can update/delete/drop the tables data based on the type of
the SQL injection
How to avoid it?
Proper input validation on the user input data to make sure that user input
must not have the SQL injections (E.g verify for characters ', SQL keywords
like OR, like, where, =, <> etc..)
Always use the prepared statements to execute the SQL statements instead
of preparing the SQL query by appending the user inputs directly to the SQL
query
Use source code analyzer tools like SonarLint\SonarQube\FindBugs in the
development environment. These tools analyze the source code and
provide feedback to the developer if it found any SQL injections found in
the source code.
Example : query = “select userid, username from Users where userid=” + userId ;
UserId is input value from user then attacker can send userId as 101 OR 1=1 instead of 101
Then above query give result set with all users available in the table.
2) Unclosed resources\Memory Leaks
4) Cross site Scripting: Inject client-side scripts into web pages viewed by other users
For the XSS attack, three things are mandatory. 1) Attacker 2) Vulnerability web
site 3) victim (An user of the vulnerability web site)
XSS attack can happen in two ways 1) Non – persistent 2) persistent
Your application takes integer but user can pass as String then need to have
the proper validation to check for String to Integer conversion
Validation against the filename\file extensions\file size
Validation against the length of the user input etc.
Validation against the null value for the user inputs