Was Material
Was Material
7. Security Headers:
- Involves the implementation of HTTP security
headers, such as HTTP Strict Transport Security
(HSTS) and Content Security Policy (CSP), to control
how browsers handle content.
8. Web Application Firewalls (WAF):
- Adds an additional layer of protection by filtering
and monitoring HTTP traffic between a web
application and the internet to detect and block
potential threats.
MZCET/CSE/VI Sem/CCS374_WAS/Unit 1/1.1 & 1.2
1.2 Web Application Security
25
Pros of Web Application Security:
1.Data Protection:
Ensures the confidentiality and integrity of
sensitive data processed by web applications.
2. User Trust:
Building and maintaining trust among users by
providing a secure online experience, protecting their
personal information.
Authentication Vs Authorization:
Authentication and authorization are fundamental
components of web application security, ensuring that
users access only the resources and functionalities they
are allowed to.
(e.g., in a database).
- If credentials are valid, the user is authenticated.
Authorization:
- Authenticated user's permissions are checked.
permissions.
- Users can access only the resources and perform only
Handshake protocol
Change-cipher spec protocol
Alert protocol
available.
Certificate expired: When a certificate has expired.
Versions of SSL:
SSL 1 – Never released due to high
insecurity.
SSL 2 – Released in 1995.
SSL 3 – Released in 1996.
TLS 1.0 – Released in 1999.
TLS 1.1 – Released in 2006.
TLS 1.2 – Released in 2008.
TLS 1.3 – Released in 2018.
SSL Certificate
SSL (Secure Sockets Layer) certificate is a digital
certificate used to secure and verify the identity of a
website or an online service.
The certificate is issued by a trusted third-party called a
Certificate Authority (CA), who verifies the identity of the
website or service before issuing the certificate.
HTTP VS HTTPS
Benefits of TLS:
Encryption:
TLS/SSL can help to secure transmitted data using
encryption.
Interoperability:
TLS/SSL works with most web browsers, including
Microsoft Internet Explorer and on most
operating systems and web servers.
use.
8. **TLS in HTTPS:**
- **Implementation:** In web applications, TLS is
commonly implemented through HTTPS (HTTP
Secure). This ensures that the communication
between the client and the server occurs over a
secure, encrypted connection.
- **URL Prefix:** URLs using HTTPS start with
"https://" instead of "http://".
Key considerations :
Session ID Security:
Use secure methods for generating and transmitting
session IDs, ensuring they cannot be easily guessed
or intercepted.
Implement secure random number generators for
creating session IDs.
Avoid exposing session IDs in URLs, as they can be
more easily compromised.
Session Timeout:
Define reasonable session timeout values to
automatically log out users after a period of inactivity.
Notify users before sessions expire to allow them to
extend their session if needed.
Session Fixation:
Implement measures to prevent session fixation
attacks where an attacker sets a user's session ID
to a known value.
Generate a new session ID upon login or after
certain privileged operations.
Logout Functionality:
Provide a secure logout mechanism that effectively
terminates a user's session.
Invalidate session data on the server side upon
logout.
Session Revocation:
Enable administrators to revoke sessions in the case
of suspicious activity or a compromised account.
Implement mechanisms to force a re-authentication
after certain sensitive operations.
Session Data Protection:
Avoid storing sensitive information in session
variables whenever possible.
Encrypt session data if it needs to be stored on the
server.
MZCET/CSE/VI Sem/CCS374_WAS/Unit 1/1.6
1.6 Session Management-Input Validation
Blacklist.
Whitelist
Whitelisting only allows data which is present on a
pre approved list to be entered into the application, all
other input that is not on the list is not accepted.
Blacklist
Blacklisting is the reverse of whitelisting, and depends
on programmers predicting all unexpected dangerous
input data.
Typically blacklisting is more error prone, as a single
mistake could be made more easily with blacklisting
which attackers could potentially identify with
enumeration.
MZCET/CSE/VI Sem/CCS374_WAS/Unit 1/1.6
1.6 Session Management-Input Validation
Whitelist
Blacklist
Key considerations :
Data Type Validation:
Ensure that input conforms to the expected data type
(e.g., numbers, dates) to prevent unexpected
behavior or security issues.
Length and Size Checks:
Validate that input lengths are within acceptable
ranges to prevent buffer overflows and other related
vulnerabilities.
Whitelisting Input:
Define and enforce a whitelist of allowed characters,
rejecting input that includes disallowed or special
characters.
Avoid using blacklists, as they can be less effective and
prone to evasion.
Regular Expressions:
Use regular expressions to define and enforce patterns
for valid input.
Be cautious with complex regular expressions to avoid
security issues like denial-of-service (DoS) attacks.
MZCET/CSE/VI Sem/CCS374_WAS/Unit 1/1.6
1.6 Session Management-Input Validation
Error Handling:
Customize error messages to avoid revealing too
much information about the system or underlying
infrastructure.
Provide generic error messages to users and log
detailed errors for administrators.
Security Headers:
Use security headers, such as Content Security Policy
(CSP), to mitigate the risk of certain types of injection
attacks.
3.Session Management:
•Use secure and random session IDs.
•Implement session timeout and reauthentication for
sensitive actions.
•Store session data securely, preferably on the server
side.
4.Cross-Site Request Forgery (CSRF) Protection:
•Include anti-CSRF tokens in forms.
•Ensure that state-changing requests require proper
authentication.
7.Error Handling:
•Provide custom error pages to avoid leaking sensitive
information.
•Log errors securely without exposing sensitive data.
8.Code Reviews and Static Analysis:
•Regularly conduct code reviews to identify security
vulnerabilities.
•Use static analysis tools to scan code for potential security
issues.
9.Dependency Management:
•Keep all dependencies up-to-date to patch known
vulnerabilities.
•Use a secure package manager and regularly audit
dependencies.
10.File Upload Security:
•Validate file types and enforce size limits.
•Store uploaded files in a secure location outside the web
root.
3.Secure Configuration:
•Disable unnecessary services and features.
•Follow security best practices for server and database
configurations.
4.Continuous Monitoring:
•Implement monitoring solutions to detect and respond
to security incidents.
•Regularly review logs for suspicious activities.
7.Environment Isolation:
•Isolate production, development, and testing
environments.
•Limit access to production systems to only authorized
personnel.
8.Regular Security Audits:
•Conduct regular security audits and penetration testing.
•Address and remediate any vulnerabilities discovered
during audits.
MZCET/CSE/VI Sem/CCS374_WAS/Unit 2/2.1
2.1Web Applications Security :Security
Testing
16
9.Security Training:
•Provide security awareness training for development
and operations teams.
•Keep teams informed about the latest security threats
and best practices.
10.Compliance:
•Ensure compliance with relevant security standards and
regulations (e.g., GDPR, HIPAA).
Security Testing:
Security testing is an important aspect of software
testing focused on identifying and addressing security
vulnerabilities in a web application.
It aims to ensure that the software is secure from
malicious attacks, unauthorized access, and data
breaches.
Security Testing:
1.Penetration Testing:
•Purpose: To identify vulnerabilities and weaknesses in
the application or network.
•Method: Ethical hackers simulate real-world attacks to
uncover security issues.
•Frequency: Conduct regular penetration tests, especially
after major updates or changes.
2.Code Review:
Purpose: Identifying security vulnerabilities in the
source code.
Method: Manual or automated review of the
application's source code.
Frequency: Regularly integrate code reviews into the
development process.
3.Vulnerability Scanning:
Purpose: Automated tools scan systems for known
vulnerabilities.
Method: Regularly scan networks, applications, and
systems for known security issues.
Frequency: Implement continuous scanning to detect and
address vulnerabilities promptly.
4.Security Audits:
•Purpose: Comprehensive review of security policies,
configurations, and practices.
•Method: Evaluate all aspects of security, including
physical security, policies, and procedures.
•Frequency: Conduct periodic security audits to ensure
ongoing compliance and effectiveness.
5.Security Automation:
• Purpose: Automating security tests and checks.
• Components:
• Risk Assessment
• Policy Development
• Team Formation
MZCET/CSE/VI Sem/CCS374_WAS/Unit 2/2.2 & 2.3
2.2 Security Incident Response Planning
8
• Classification
• Identification
• Eradication
• Containment:
• Steps to prevent further damage and limit the
incident's impact.
• Isolation of affected systems.
Recovery Phase:
• Objective: Recover affected systems and services.
• Steps to restore systems to normal operation.
• Components:
• Recovery Planning
• System Restoration
• Threat Modeling
– Systematic review of features and product
architecture from a security point of view
– Identify threats and mitigations
Response
What is CLASP?
Comprehensive, Lightweight, Application Security
Process
OWASP project
“Activity driven, role-based set of process components
whose core contains formalized best practices for
building security into your existing or new-start
software development life cycles in a structured,
repeatable, and measurable way”
What is CLASP?
Method for applying security to an organization's
application development process
Adaptable to any organization or development process
OWASP CLASP is intended to be a complete solution
that organizations can read and then implement
iteratively
Focuses on leveraging a database of knowledge (CLASP
vulnerability lexicon, security services, security
principles, etc) and automated tools/processes
MZCET/CSE/VI Sem/CCS374_WAS/Unit 2/2.4
2.4 OWASP Comprehensive Lightweight
Application Security Process (CLASP)
8
CLASP Best Practices
Institute security awareness programs
Provide security training to stakeholders
Present organization's security policies, standards,
and secure coding guidelines
Perform application assessments
Is a central component in overall strategy
Find issues missed by implemented “Security
Activities”
Leverage to build a business case for implementing
CLASP
MZCET/CSE/VI Sem/CCS374_WAS/Unit 2/2.4
2.4 OWASP Comprehensive Lightweight
Application Security Process (CLASP)
9
CLASP Best Practices
Capture security requirements
Specify security requirements along side
business/application requirements
Implement secure development process
Include “Security Activities”, guidelines, resources,
and continuous reinforcement
Build vulnerability remediation procedures
Define steps to identify, assess, prioritize, and
remediate vulnerabilities
What is SAMM?
The Software Assurance Maturity Model (SAMM) is
an open framework to help organizations formulate
and implement a strategy for software security that
is tailored to the specific risks facing the
organization.
YEAR/SEM:III/VI
THENMOZHI. P
DEPT:CSE
AP/CSE
3.1 API Security :Session Cookies
API security:
• Application programming interface (API) security refers to the
practice of preventing or mitigating attacks on APIs.
• APIs work as the backend framework for mobile and web
applications. Therefore, it is critical to protect the sensitive data
they transfer.
• An API is an interface that defines how different software
interacts. It controls the types of requests that occur between
programs, how these requests are made, and the kinds of data
formats that are used.
API security:
The primary goal of API security is to protect the data and
functions exposed through an API by ensuring that only
authorized users have access, securing communication, and
preventing common security risks.
Session cookies and token-based authentication are both crucial
elements in API security, providing mechanisms to authenticate
users and authorize access to resources.
Attributes Meaning
Secure cookies are only ever sent over a HTTPS
Secure connection and so cannot be stolen by network
eavesdroppers.
Cookies marked HttpOnly cannot be read by
HttpOnly JavaScript, making them slightly harder to steal
through XSS attacks.
SameSite cookies will only be sent on requests
SameSite
that originate from the same origin as the cookie.
They then inject that session token into the victim’s browser and
trick them into logging in.
Authentication Persistence:
Stateful Communication:
Vulnerability Concerns:
Web token.
Stateless Communication:
When a user logs in, the server issues a token (usually a JSON
Web Token or JWT) containing user information and permissions.
Enhanced Security:
They reduce the risk of session hijacking because the token itself
doesn't contain sensitive information, and its contents can be
verified for integrity.
1.Authentication:
• Authentication ensures that the identities of clients
accessing microservice APIs are verified.
• It involves mechanisms to validate the credentials
provided by the client, such as usernames, passwords,
API keys, or tokens. Common authentication protocols
include OAuth 2.0, JWT (JSON Web Tokens), and basic
authentication.
YEAR/SEM:III/VI
THENMOZHI. P
D E P T: C S E
A P/ C S E
4.1 Vulnerability Assessment Lifecycle
What is a vulnerability Assessment lifecycle?
• Vulnerability management lifecycle is a systematic process of
discovering, analyzing, prioritizing, and mitigating
vulnerabilities in an organization’s systems and software for
continuous improvement.
• It helps detect and report security weaknesses continuously for
patch applications and protecting against cyber threats.
• The Vulnerability Assessment Lifecycle outlines the steps
involved in identifying, assessing, prioritizing, and mitigating
vulnerabilities within an organization's IT infrastructure.
YEAR/SEM:III/VI
THENMOZHI. P
D E P T: C S E
A P/ C S E
5.1 Social Engineering, Injection
Injection attack
• An injection attack is a type of security exploit where malicious
code is injected into an application or system, typically through
input fields such as forms on a website or database queries.
• The goal of an injection attack is to manipulate the behavior of
the application in order to gain unauthorized access to data,
execute arbitrary commands, or perform other malicious actions.
SQL Injection: Involves injecting SQL (Structured Query
Language) code into a database query through input fields or
parameters, allowing attackers to manipulate the database or
retrieve sensitive information.
What Is SQL?
• Structured Query Language, or SQL, extracts data and data
structures in relational databases.
• Relational databases store data in tables; each row in a table is a
data item (for example, a user, or a product being sold).
• SQL syntax allows applications such as web servers to add rows to
the database by using INSERT statements, read rows by using
SELECT statements, update rows by using UPDATE statements,
and remove rows by using DELETE statements.
What is XSS ?
• Cross site scripting (XSS) is a common attack vector that injects
malicious code into a vulnerable web application.
• XSS differs from other web attack vectors (e.g., SQL injections),
in that it does not directly target the application itself.
• Instead, the users of the web application are the ones at risk.
• A successful cross site scripting attack can have devastating
consequences for an online business’s reputation and its
relationship with its clients.
What is XSS ?
• Cross site scripting (XSS) is a common attack vector that injects
malicious code into a vulnerable web application.
• XSS differs from other web attack vectors (e.g., SQL injections),
in that it does not directly target the application itself.
• Instead, the users of the web application are the ones at risk.
• A successful cross site scripting attack can have devastating
consequences for an online business’s reputation and its
relationship with its clients.
DOM-based XSS
Broken Authentication:
1. Weak Password Policies:
Vulnerability: Lack of password complexity requirements or
enforcement of weak passwords.
Mitigation:
Enforce strong password policies including minimum length,
complexity requirements, and password expiration.
Educate users about creating strong, unique passwords or
passphrases.
Implement multi-factor authentication (MFA) to add an extra
layer of security.
Broken Authentication:
3. Credential Exposure:
Vulnerability: Storing sensitive credentials in plaintext,
transmitting them over insecure channels, or exposing them
through error messages or logs.
Mitigation:
Hash passwords using strong cryptographic algorithms with
unique salts.
Encrypt sensitive data in transit using secure protocols like
HTTPS.
Avoid exposing sensitive information in error messages or logs.
Session Management:
1. Session Fixation:
Vulnerability: Attackers can force users to authenticate using
session identifiers controlled by the attacker, allowing them to
hijack the victim's session.
Mitigation:
Generate new session identifiers upon successful
authentication.
Invalidate any existing session identifiers to prevent session
fixation attacks.
What is CSRF ?
CSRF stands for Cross-Site Request Forgery. It is a type of security
vulnerability that occurs when a malicious website, email, or
other mechanism tricks a user's web browser into performing an
unwanted action on a trusted site where the user is
authenticated.