Unit4 - Subjective Questions
INT245 • Practice Questions with Detailed Answers
Explain the significance of the OWASP Top 10 in the context of web application penetration testing. Briefly describe any three vulnerabilities listed in the current OWASP Top 10.
The OWASP Top 10 is a standard awareness document for developers and web application security. It represents a broad consensus about the most critical security risks to web applications. For penetration testers, it serves as a checklist to ensure critical vulnerabilities are not overlooked.
Selected Vulnerabilities:
- Broken Access Control: Failures to enforce policies on what users can do (e.g., a standard user accessing admin pages).
- Cryptographic Failures: Previously known as Sensitive Data Exposure. This involves failing to encrypt data at rest or in transit (e.g., transmitting passwords in clear text).
- Injection: Occurs when untrusted data is sent to an interpreter as part of a command or query. SQL Injection (SQLi) is a common example where attackers execute malicious SQL statements.
Differentiate between Reflected XSS, Stored XSS, and DOM-based XSS attacks.
Cross-Site Scripting (XSS) allows attackers to execute malicious scripts in the victim's browser.
-
Reflected XSS (Non-Persistent):
- The malicious script is reflected off the web server, such as in an error message or search result.
- The payload is delivered via a link; it is not stored in the database.
- Example: Clicking a link containing
<script>alert(1)</script>in the URL parameters.
-
Stored XSS (Persistent):
- The malicious script is permanently stored on the target server (e.g., in a database, forum post, or comment field).
- The victim retrieves the malicious script when they view the stored content.
- Impact: Higher, as it affects anyone viewing the page.
-
DOM-based XSS:
- The vulnerability exists in the client-side code rather than the server-side code.
- The attack payload is executed as a result of modifying the DOM environment in the victim's browser.
Describe the mechanism of a SQL Injection (SQLi) attack. Provide a theoretical example of how an authentication bypass might occur using SQLi.
SQL Injection is a code injection technique where an attacker inserts malicious SQL statements into entry fields for execution (e.g., to dump the database contents to the attacker).
Mechanism:
It occurs when user input is not sanitized or validated and is concatenated directly into a database query. This allows the attacker to manipulate the query structure.
Authentication Bypass Example:
Consider a login query:
SELECT * FROM users WHERE username = 'pass';
If the attacker inputs admin' -- into the username field, the query becomes:
SELECT * FROM users WHERE username = 'admin' --' AND password = '...';
- The
'closes the username string. - The
--comments out the rest of the query (ignoring the password check). - Result: The attacker logs in as 'admin' without a password.
What is Session Hijacking? Explain the difference between Session Sniffing and Session Fixation.
Session Hijacking is an attack where an intruder takes over a legitimate user's valid session. This allows the attacker to access the application as the victim without knowing their login credentials.
Differences:
-
Session Sniffing:
- The attacker uses packet sniffing tools (like Wireshark) to capture valid Session IDs transmitting over an unencrypted network (HTTP).
- Defense: Use HTTPS/TLS.
-
Session Fixation:
- The attacker sets (fixes) a user's session ID before the user even logs in.
- The attacker sends a link with a specific Session ID to the victim. Once the victim logs in using that ID, the attacker uses the known ID to hijack the session.
- Defense: Regenerate Session IDs upon successful authentication.
Define Cross-Site Request Forgery (CSRF) and explain how attackers craft such requests.
CSRF is an attack that forces an end user to execute unwanted actions on a web application in which they are currently authenticated.
Mechanism:
- The victim logs into a trusted site (e.g., a bank).
- The attacker tricks the victim into visiting a malicious site or clicking a link.
- The malicious site contains a hidden request (e.g., an image tag or auto-submitting form) targeting the trusted site:
<img src="http://bank.com/transfer?amount=1000&to=Attacker">. - The browser sends the request to the bank including the victim's session cookies.
- The bank validates the cookies and processes the transfer, assuming the user intended it.
Discuss the various Mobile Device Deployment Models used in enterprise environments and their security implications.
Enterprises use different models to manage mobile devices, each with unique security profiles:
- BYOD (Bring Your Own Device):
- Employees use personal devices for work.
- Risk: High. IT lacks full control over the device health, apps, or patching.
- COPE (Corporate-Owned, Personally Enabled):
- The company owns the device but allows personal use.
- Risk: Medium. IT can wipe the device but personal privacy concerns exist.
- CYOD (Choose Your Own Device):
- Employees choose from a pre-approved list of devices owned by the company.
- Risk: Lower. Standardized hardware makes support and security easier.
- COBO (Corporate-Owned, Business Only):
- Strictly for work; no personal apps allowed.
- Risk: Lowest. Complete lockdown and control.
How can a penetration tester identify SQL Injection vulnerabilities in a web application? List three common techniques.
Penetration testers identify SQLi by supplying input that interferes with the SQL query logic.
Techniques:
- Single Quote Test (
'):- Input a single quote into a form field or URL parameter. If the application returns a database syntax error (e.g., "You have an error in your SQL syntax"), it is likely vulnerable.
- Boolean Inference (True/False):
- Inject conditions like
OR 1=1(True) vsOR 1=0(False). - If the page content differs significantly (e.g., showing all records vs no records), the application is interpreting the injected SQL.
- Inject conditions like
- Timing Attacks (Blind SQLi):
- Inject a command to pause the database, such as
WAITFOR DELAY '0:0:5'(SQL Server) orSLEEP(5)(MySQL). - If the web page takes 5 seconds longer to load, the vulnerability is confirmed.
- Inject a command to pause the database, such as
Explain the concept of Blind SQL Injection and distinguish it from In-band SQL Injection.
Blind SQL Injection occurs when an application is vulnerable to SQLi but does not return the results of the SQL query or database errors to the user's screen. The attacker must infer the data by asking the database True/False questions.
- In-band SQLi (Classic): The attacker uses the same communication channel to launch the attack and gather results (e.g., seeing data dumped on the webpage or viewing error messages).
- Blind SQLi (Inferential): The attacker cannot see data directly. They reconstruct data character by character based on:
- Boolean-based: Changes in page content.
- Time-based: Delays in server response time.
Compare Bluejacking, Bluesnarfing, and Bluebugging in the context of Bluetooth hacking.
These are attacks targeting Bluetooth-enabled devices:
- Bluejacking:
- Sending unsolicited messages (e.g., vCards or images) to nearby Bluetooth devices.
- Severity: Low. It is mostly annoying but does not steal data.
- Bluesnarfing:
- The unauthorized theft of information from a Bluetooth device.
- Impact: Attackers can access contact lists, emails, and text messages without the user's knowledge.
- Bluebugging:
- A more advanced attack where the attacker takes full control of the phone.
- Impact: The attacker can make calls, send SMS, listen to phone conversations, and connect to the internet via the victim's device.
What are the primary security risks associated with Jailbreaking (iOS) or Rooting (Android) mobile devices from a corporate perspective?
Rooting (Android) or Jailbreaking (iOS) involves removing manufacturer-imposed software restrictions to gain privileged control (root access).
Security Risks:
- Bypassing the Sandbox: Apps can access data belonging to other apps (e.g., a rogue game reading banking app data).
- Malware Susceptibility: Users can install apps from unofficial stores (sideloading) which often contain malware.
- Disabled Security Updates: Rooted devices often cannot receive official OTA (Over-The-Air) security patches.
- MDM Failure: Mobile Device Management (MDM) solutions may fail to enforce policies or wipe data on compromised devices.
Describe Social Engineering attacks. Explain Phishing, Vishing, and Smishing.
Social Engineering relies on manipulating human psychology rather than technical hacking to gain access to systems or data.
- Phishing:
- Sending fraudulent emails appearing to be from reputable sources to induce individuals to reveal personal information (passwords, credit cards).
- Vishing (Voice Phishing):
- Using telephone scams to trick victims. Attackers may impersonate bank officials or tech support to extract credentials or OTPs.
- Smishing (SMS Phishing):
- Using text messages (SMS) to lure victims into clicking malicious links or calling fraudulent numbers.
Explain the methodology used for Exploiting Browsers during a penetration test. What is the role of frameworks like BeEF?
Browser exploitation targets vulnerabilities in the web browser software or its plugins (Flash, Java, PDF readers) to execute code on the client machine.
Methodology:
- Fingerprinting: Identify the victim's browser type, version, OS, and installed plugins.
- Hooking: Trick the victim into visiting a malicious page containing a "hook" script.
- Command Execution: Once hooked, the attacker sends commands to the browser.
BeEF (Browser Exploitation Framework):
BeEF is a penetration testing tool that focuses on the web browser. It uses a client-side JavaScript hook (hook.js) to turn the victim's browser into a "zombie." It allows testers to launch attacks, scan the internal network from the browser, and steal cookies.
What is Insecure Direct Object Reference (IDOR)? Provide an example of how it can be exploited.
IDOR is an access control vulnerability that occurs when an application exposes a reference to an internal implementation object (like a file or database key) without validating the user's authorization to access it.
Example:
- Scenario: A user accesses their profile via the URL:
https://example.com/profile?user_id=100. - Exploit: The user changes the parameter to
user_id=101. - Result: If the server does not verify that the currently logged-in user actually owns account 101, the attacker views another user's private data.
- Remediation: Implement proper access control checks and use indirect references (like session-based lookups) instead of direct database IDs.
Detail the phases of Mobile Device Exploitation using malware. What are the common types of mobile malware?
Mobile exploitation via malware involves infecting the device to steal data, track users, or incur charges.
Common Types:
- Trojans: Apps that look legitimate (e.g., a flashlight app) but perform malicious activity in the background.
- Spyware: Software that secretly monitors usage, GPS location, and intercepts SMS/Calls.
- Ransomware: Locks the mobile device or encrypts files (photos/contacts) demanding payment.
Infection Vectors:
- Repackaging: Attackers download popular apps, inject malicious code, and upload them to third-party stores.
- Drive-by Downloads: Malware installs automatically when visiting a malicious mobile website.
- SMS/MMS: Malicious links sent via text.
In the context of SQL Injection, explain the UNION-based attack strategy.
UNION-based SQLi is an in-band injection technique that leverages the UNION SQL operator to combine the results of two or more SELECT statements into a single result set which is then returned to the HTTP response.
Requirements:
- Same number of columns: The injected query must have the same number of columns as the original query.
- Data types: The data types in the corresponding columns must be compatible.
Example:
Original: SELECT name, description FROM products WHERE id=1
Injection: 1 UNION SELECT username, password FROM users
Result: The application displays product details followed immediately by the usernames and passwords from the database.
What is Security Misconfiguration in web applications? How does it aid attackers?
Security Misconfiguration is a broad category of vulnerabilities arising from insecure default settings, incomplete configurations, or verbose error messages.
Examples aiding attackers:
- Default Accounts: Leaving default admin/password combinations active (e.g., Tomcat, WordPress).
- Directory Listing: If disabled, attackers can see all files in a directory, potentially finding backup files or config files.
- Verbose Error Messages: Displaying full stack traces to users reveals the underlying technology, framework versions, and sometimes code snippets, helping attackers tailor their exploits.
- Unpatched Services: Running outdated software with known vulnerabilities.
Describe the Man-in-the-Browser (MitB) attack. How does it differ from a standard Man-in-the-Middle (MitM) attack?
Man-in-the-Browser (MitB) is a specific type of attack where a Trojan infects the web browser itself.
Mechanism:
It modifies web pages and transaction content strictly within the browser, in real-time, after SSL/TLS decryption has occurred but before the user sees it (or before the browser sends it).
Difference from MitM:
- MitM: Intercepts traffic on the network (between the user and server). It struggles with encrypted traffic (HTTPS) unless SSL stripping is used.
- MitB: Resides inside the browser/OS. It can read data in clear text because the browser has already decrypted the SSL traffic. It can manipulate banking transactions even if the connection is perfectly secure.
List and explain five mitigation strategies for Mobile Device Security in an enterprise.
- Mobile Device Management (MDM): Centralized software to enforce security policies (passcodes, encryption) and remote wipe capabilities.
- Containerization: Separating corporate data from personal data within the device using encrypted containers.
- App Whitelisting: allowing only approved applications to be installed on corporate devices.
- Strong Authentication: Enforcing Biometrics (Fingerprint/FaceID) or Multi-Factor Authentication (MFA) to access corporate resources.
- OS Updates: Mandating that devices run the latest OS versions to ensure security patches are applied.
Explain Broken Authentication vulnerabilities. How can attackers exploit them and how can they be prevented?
Broken Authentication allows attackers to compromise passwords, keys, or session tokens to assume the identities of other users.
Exploitation:
- Credential Stuffing: Using lists of compromised username/passwords from other breaches.
- Brute Force: Automated guessing of passwords.
- Session ID URL Rewriting: Exposing session IDs in the URL.
Prevention:
- Implement Multi-Factor Authentication (MFA).
- Do not allow weak passwords (enforce complexity).
- Limit failed login attempts (account lockout).
- Use standard, secure session management (do not write custom session code).
Derive the logic behind a Boolean-based Blind SQL Injection attack using the example of a login page.
In Boolean-based Blind SQLi, the attacker asks the database True/False questions and observes the application's response (e.g., "Login Failed" vs. a generic error, or slight changes in page size).
Scenario:
Attacker wants to find the length of the database version string.
Logic:
- Hypothesis: Is the length of the version string greater than 5?
- Injection:
id=1 AND LENGTH(@@version) > 5 - Result: If the page loads normally (True), the length is > 5.
- Injection:
- Refinement: Is it greater than 10?
- Injection:
id=1 AND LENGTH(@@version) > 10 - Result: If page loads empty/error (False), the length is between 6 and 10.
- Injection:
- Conclusion: The attacker iterates (binary search) until the exact character or length is found, extracting data one bit at a time without ever seeing the data displayed.