Seminar Web Application Security
Seminar Web Application Security
SECURITY
By Vishal Tayade & Gauravi Wani
Threats
What is Web Application Security?
● Injection flaws, particularly SQL injection, are common in web applications. Injection occurs
when user-supplied data is sent to an interpreter as part of a command or query. The attacker’s
hostile data tricks the interpreter into executing unintended commands or changing data.
● Some common types of command injection flaws include:
1. SQL injection (malicious calls to backend databases via SQL), using shell commands to run
external programs
2. Using system calls to in turn make calls to the operating system.
A2. Injections Flaws: Protection
● Use language specific libraries to perform the same functions as shell commands and system calls
● Check for existing reusable libraries to validate input, and safely perform system functions, or
develop your own.
● Perform design and code reviews on the reusable libraries to ensure security.
● Other common methods of protection include:
a. Use stored Procedures
b. Data validation (to ensure input isn't malicious code),
c. Run commands with very minimal privileges
d. If the application is compromised, the damage will be minimized.
A3. Malicious File Execution
● Code vulnerable to remote file inclusion (RFI) allows attackers to include hostile code and data,
resulting in devastating attacks, such as total server compromise. Malicious file execution attacks
affect PHP, XML and any framework which accepts filenames or files from users
● Applications which allow the user to provide a filename, or part of a filename are often vulnerable
if input is not carefully validated.
● Allowing the attacker to manipulate the filename may cause application to execute a system
program or external URL.
● Applications which allow file uploads have additional risks
A2. Injections Flaws: Protection
● Use language specific libraries to perform the same functions as shell commands and system calls
● Check for existing reusable libraries to validate input, and safely perform system functions, or
develop your own.
● Perform design and code reviews on the reusable libraries to ensure security.
A3. Malicious File Execution
● Code vulnerable to remote file inclusion (RFI) allows attackers to include hostile code and data,
resulting in devastating attacks, such as total server compromise.
● Malicious file execution attacks affect PHP, XML and any framework which accepts filenames or
files from users.
A3. Malicious File Execution Protection
● Do not allow user input to be used for any part of a file or path name.
● Where user input must influence a file name or URL, use a fully enumerated list to positively
validate the value.
● File uploads have to be done VERY carefully.
1. Only allow uploads to a path outside of the webroot so it can not be executed
2. Validate the file name provided so that a directory path is not included.
3. Implement or enable sandbox or chroot controls which limit the applications access to files.
A4. Insecure Direct Object Reference
● Applications can unintentionally leak information about their configuration, internal workings, or
violate privacy through a variety of application problems. Attackers use this weakness to steal
sensitive data or conduct more serious attacks.
Improper Error Handling: Protection
● Prevent display of detailed internal error messages including stack traces, messages with database
or table names, protocols, and other error codes. (This can provide attackers clues as to potential
flaws.)
● Good error handling systems should always enforce the security scheme in place while still being
able to handle any feasible input.
● Provide short error messages to the user while logging detailed error information to an internal
log file.
Information Leakage - Protections
● Account credentials and session tokens are often not properly protected. Attackers compromise
passwords, keys, or authentication tokens to assume other users’ identities.
Session Management: Protection
● Password Change Controls - require users to provide both old and new passwords
● Forgotten Password Controls - if forgotten passwords are emailed to users, they should be required to
re-authenticate whenever they attempt to change their email address.
● Password Strength - require at least 7 characters, with letters, numbers, and special characters both
upper case and lower case.
● Password Expiration - Users must change passwords every 90 days, and administrators every 30 days.
● Password Storage - never store passwords in plain text. Passwords should always be stored in either
hashed (preferred) or encrypted form.
● Protecting Credentials in Transit - to prevent
● "man-in-the-middle" attacks the entire authenticated session / transaction should be encrypted SSLv3
or TLSv1 Man-in-the-middle attacks - are still possible with SSL if users disable or ignore warnings
about invalid SSL certificates.
● Replay attacks - Transformations such as hashing on the client side provide little protection as the
hashed version can simply be intercepted and retransmitted so that the actual plain text password is
not needed.
A8. Insecure Cryptographic Storage
● Web applications rarely use cryptographic functions properly to protect data and credentials.
Attackers use weakly protected data to conduct identity theft and other crimes, such as credit
card fraud.
● The majority of Web applications in use today need to store sensitive information (passwords,
credit card numbers, proprietary information, etc.) in a secure fashion.
● The use of encryption has become relatively easy for developers to incorporate.
● Proper utilization of cryptography, however, can remain elusive by developers overestimating the
protection provided by encryption, and underestimating the difficulties of proper implementation
and protecting the keys.
Insecure Cryptographic Storage: Protection
● Applications frequently fail to encrypt network traffic when it is necessary to protect sensitive
communications.
● Failure to encrypt network traffic leaves the information available to be sniffed from any
compromised system/device on the network.
● Switched networks do not provide adequate protection
Insecure Communications: Protection
● Use SSL/TLS for ALL connections that are authenticated or transmitting sensitive information
● Use SSL/TLS for mid-tier and internal network communications between Web Server,
Application and database.
● Configure Desktop Clients and Servers to ensure only SSLv3 and TLSv1 are used with strong
ciphers.
● Use only valid trusted SSL/TLS certificates and train users to expect valid certificates to prevent
Man-in-theMiddle attacks.
A10. Failure to Restrict URL Access
● Frequently, an application only protects sensitive functionality by preventing the display of links
or URLs to unauthorized users. Attackers can use this weakness to access and perform
unauthorized operations by accessing those URLs directly.
● When the application fails to restrict access to administrative URLs, the attacker can access
normally unauthorized areas by type in the URL’s into the browser.
A10. Failure to Restrict URL Access : Protection
● Create an application specific security policy during the requirements phase.
● Document user roles as well as what functions and content each role is authorized to access.
● Specifying access requirements up front allows simplification of the design
● If your access control is not simple it won't be secure.
Other Web Application Security Threats