Web Security Basics 1
Web Security Basics 1
Web Security Basics 1
SECURITY
OBJECTIVES
By the end of this lesson, students will be able to:
1 2 3
Define the Basics of Web security and VAPT test cases for a
Web and How does a common security Web Application and
website work flaws in Web best practices
Applications
BASICS OF WEB
How Does a Website Work?
What happens when you visit a website?
500 - INTERNAL ERROR WHERE THE SERVER DOESN'T KNOW HOW TO HANDLE THE REQUEST.
HTTP
HTTPS
COOKIES, SESSIONS, SOP
https://noobsec.notion.site/Cookies-and-Sessions-038cbb5d686c4a199c3540fb51da07c1
https://noobsec.notion.site/Sessions-bce1704984574f02a12198a2da31afc8
https://noobsec.notion.site/Same-Origin-Policy-e879e37292de402f8dac8330446f147c
OWASP TOP 10
Rank Category Description
Applications fail to properly restrict access to functionality or data based on user roles or permissions. Attackers can exploit this to access
1 Broken Access Control (A01:2021)
unauthorized data, modify data, or perform unauthorized actions.
Weak encryption algorithms, insecure key management, or missing encryption altogether can leave sensitive data vulnerable to interception or
2 Cryptographic Failures (A02:2021)
tampering.
Attackers can inject malicious code (like SQL or script) into user inputs that are not properly validated and sanitized. This code can then be
3 Injection (A03:2021)
executed by the application, potentially leading to data breaches or system compromise.
Fundamental security flaws built into the application design make it inherently vulnerable to attack. This can include insecure data flows, lack of
4 Insecure Design (A04:2021)
proper authorization checks, or use of unsafe APIs.
Applications or systems are not configured securely by default. This can leave them vulnerable to common attacks by exploiting default settings or
5 Security Misconfiguration (A05:2021)
misconfigured security features.
Vulnerable and Outdated Components Applications rely on libraries, frameworks, or other components with known vulnerabilities. Attackers can exploit these vulnerabilities to gain a
6
(A06:2021) foothold in the system.
Identification and Authentication Failures Weak password policies, insecure authentication mechanisms, or lack of multi-factor authentication can make it easier for attackers to steal
7
(A07:2021) credentials or impersonate legitimate users.
Software and Data Integrity Failures Applications fail to ensure the integrity of software and data. Attackers can exploit this to tamper with code or data, potentially leading to
8
(A08:2021) unexpected behavior or security breaches.
Server-Side Request Forgery (SSRF) Attackers can trick the application into making unauthorized requests to external servers. This could be used to steal data, carry out denial-of-
10
(A10:2021) service attacks, or gain internal network access.
BROKEN ACCESS CONTROL
Broken access control refers to a security vulnerability that occurs
when a system fails to properly enforce restrictions on what
authenticated users are allowed to do. Essentially, it means that
users can access resources or perform actions that they shouldn't
be able to do according to their permissions. This can result in
unauthorized access to sensitive data, manipulation of data, or
other malicious activities.
LAB: SECURITY-PEDIA.COM
BROKEN ACCESS CONTROL
Impact and Prevention
Impact:
Broken access controls increase the risk of compromise, endangering data confidentiality and integrity.
Attackers can exploit vulnerabilities to impersonate users or administrators, access privileged functions,
manipulate content, or gain full control of web applications.
Additional attacks targeting the web server and infrastructure may also occur.
The business impact varies depending on the application and data protection needs.
Prevention:
Cross-Site Scripting, better known as XSS in the cybersecurity Reflected XSS: Reflected XSS occurs when
community, is classified as an injection attack where malicious user input is immediately returned by a web
JavaScript gets injected into a web application with the intention of application in an error message, search
being executed by other users. This vulnerability is extremely result, or any other response that includes
common nowadays. some or all of the input provided by the user
The best way to introduce XSS is with a basic example. Consider the as part of the request, without that data
following PHP code: being made safe to render in the browser,
and without permanently storing the user
<?php provided data.
echo '<h4>Hello ' . $_GET['name'] . '</h4>';
?> Stored XSS: Stored XSS generally occurs when
The above (silly) code prints a welcome message to the user whose user input is stored on the target server, such
name is retrieved from the $_GET variable. Hello ' . $_GET['name'] . ''; ? as in a database, in a message forum, visitor
> log, comment field, etc. And then a victim is
There are commonly two types of XSS: Reflected XSS and Stored XSS. able to retrieve the stored data from the web
There is another type of XSS, named DOM-based xss. application without that data being made safe
to render in the browser.
CROSS SITE SCRIPTING
How to Exploit?
Find parameter
Find Input field
Check for injection
Check the context
Attempt to exploit
LAB: security-vault.security-pedia.com
XSS
VAPT Test Cases
More Readings:
https://noobsec.notion.site/Introduction-to-XSS-By-Mehedi-Hasan-42a1a052ec80430fa7d31358f04a9fae?pvs=4
https://noobsec.notion.site/XSS-writeup-by-Mehedi-Hasan-509e4e90d90747869d589e41f6b52d27?pvs=4