Common Vulnerabilities: SQL Injection and Cross-Site Scripting Quiz

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the purpose of port scanning?

  • To verify the security policy of a server or host
  • To identify running services on a host
  • To find active ports on a server or host
  • All of the above (correct)

Which port is used for the Hypertext Transfer Protocol (HTTP)?

  • 80 (correct)
  • 443
  • 21
  • 22

What is the purpose of a 'close port'?

  • The host sends a reply indicating the port is open
  • The host does not reply, indicating the port is filtered
  • The host sends a reply indicating the connection will be denied (correct)
  • The host sends a reply indicating the port is active

What type of port is used for the File Transfer Protocol (FTP) data transfer?

<p>20 (A)</p> Signup and view all the answers

Which protocol uses port 22 for secure login?

<p>Secure Shell (SSH) (B)</p> Signup and view all the answers

What is the purpose of a 'filtered port'?

<p>The host does not reply, indicating the port is filtered (B)</p> Signup and view all the answers

How can SQL injection be prevented?

<p>Using parameterized queries (B)</p> Signup and view all the answers

What is the main risk associated with Cross-Site Scripting (XSS)?

<p>Theft of sensitive information (A)</p> Signup and view all the answers

How does CSRF attack work?

<p>Causing a user's browser to perform unwanted actions on trusted sites (C)</p> Signup and view all the answers

What is the consequence of Buffer Overflow?

<p>Potential code execution by an attacker (C)</p> Signup and view all the answers

How can Security Misconfigurations be avoided?

<p>Using secure coding practices (D)</p> Signup and view all the answers

What is the recommended method to prevent SQL injection?

<p>Implementing input validation (B)</p> Signup and view all the answers

What is the main purpose of the 'socat' command?

<p>To connect stdio to a remote TCP port (A)</p> Signup and view all the answers

What is the purpose of a port redirection tool?

<p>To route traffic between two different ports (B)</p> Signup and view all the answers

Which of the following is a Unix-based port redirection tool mentioned in the text?

<p>datapipe (A)</p> Signup and view all the answers

What does the 'localhost' argument represent in the 'datapipe' command?

<p>The IP address on which to open the listening port (C)</p> Signup and view all the answers

How is data transmitted when using the 'socat' command?

<p>Data is piped into the command and forwarded to the remote host (A)</p> Signup and view all the answers

What is the purpose of using a port redirection tool between a browser and a web server?

<p>To allow the browser to access the web server without knowing its IP address (D)</p> Signup and view all the answers

What is the purpose of the localport argument in the given context?

<p>It specifies the port number on the local system to listen for incoming connections. (B)</p> Signup and view all the answers

Why might you receive a "bind: Permission denied" error when opening a listening port below 1024 on UNIX systems?

<p>Your account does not have the required privileges to open reserved ports. (A)</p> Signup and view all the answers

What is the typical value for the remoteport argument when forwarding traffic to a web server?

<p>80 (A)</p> Signup and view all the answers

What does the remotehost argument represent in the context of port redirection?

<p>The hostname or IP address of the target system to which traffic is forwarded. (B)</p> Signup and view all the answers

What is the purpose of the datapipe tool mentioned in the text?

<p>It forwards traffic between TCP ports without modifying the data. (B)</p> Signup and view all the answers

What is a key difference between datapipe and FPipe mentioned in the text?

<p><code>FPipe</code> supports both TCP and UDP protocols, while <code>datapipe</code> only supports TCP. (A)</p> Signup and view all the answers

What tool in the Nmap suite is used for comparing scan results?

<p>Ndiff (B)</p> Signup and view all the answers

Which movie featured Nmap among its tools?

<p>The Matrix Reloaded (B)</p> Signup and view all the answers

What does Amap aim to identify?

<p>Applications on non-standard ports (B)</p> Signup and view all the answers

In which mode of THC - Amap does it not perform service identification?

<p>-B (C)</p> Signup and view all the answers

What characteristic is NOT attributed to NMAP in the text?

<p>Expensive (B)</p> Signup and view all the answers

Which tool in the Nmap suite focuses on packet generation and response analysis?

<p>Nping (B)</p> Signup and view all the answers

Flashcards are hidden until you start studying

Study Notes

Ports and Protocols

  • Ephemeral ports: a range of ports allocated by a web browser when connecting to a web server
  • Well-known ports:
    • 20: FTP (File Transfer Protocol) data transfer
    • 21: FTP command control
    • 22: SSH (Secure Shell) secure login
    • 23: Telnet remote login service
    • 25: SMTP (Simple Mail Transfer Protocol) email routing
    • 53: DNS (Domain Name System) service
    • 67, 68: DHCP (Dynamic Host Configuration Protocol)
    • 80: HTTP (Hypertext Transfer Protocol) used in the World Wide Web
    • 110: POP3 (Post Office Protocol version 3) email retrieval
    • 119: NNTP (Network News Transfer Protocol)
    • 123: NTP (Network Time Protocol)
    • 143: IMAP (Internet Message Access Protocol) email retrieval
    • 161: SNMP (Simple Network Management Protocol)
    • 194: IRC (Internet Relay Chat)
    • 443: HTTPS (HTTP over TLS/SSL) secure web browsing

Port Scanning

  • Port scanner: software designed to probe a server or host for open ports
  • Port scan: a process that sends a client request to a server to find active ports
  • Open port: a port that responds to a request, indicating it is active
  • Closed port: a port that does not respond to a request, indicating it is inactive
  • Filtered port: a port that does not respond to a request, but may be active
  • Vulnerabilities: open ports or operating system vulnerabilities can be exploited by attackers

Vulnerabilities and Prevention

  • SQL Injection (SQLi):
    • Description: injecting malicious SQL statements to gain unauthorized access to a database
    • Prevention: use parameterized queries, input validation, and least privilege principles
  • Cross-Site Scripting (XSS):
    • Description: injecting malicious scripts into web pages to steal sensitive information or hijack sessions
    • Prevention: input validation, output encoding, and secure coding practices
  • Cross-Site Request Forgery (CSRF):
    • Description: tricking a user into performing unwanted actions on a trusted site
    • Prevention: use anti-CSRF tokens, same-site attribute for cookies, and proper authentication
  • Buffer Overflow:
    • Description: exploiting a program's buffer overflow to execute malicious code
    • Prevention: bounds checking, input validation, and secure coding practices
  • Security Misconfigurations:
    • Description: improper configuration of settings, permissions, or defaults that expose sensitive information or provide unauthorized access

Port Redirection Tools

  • Datapipe:
    • A Unix-based port redirection tool
    • Functions as a channel for TCP/IP connections
    • Redirects traffic from one port to another
    • Example usage: $ ./datapipe localhost localport remotehost remoteport
  • FPipe:
    • A Windows-based port redirection tool
    • Adds UDP protocol and outbound source port number support
  • Nmap:
    • A flexible data transfer, redirection, and debugging tool
    • Part of the Nmap suite
  • THC-Amap:
    • A next-generation scanning tool for pentesters
    • Attempts to identify applications even if running on a different port
    • Identifies non-ASCII based applications
    • Modes:
      • -A: identifies the service associated with the port
      • -B: does not perform identification
      • -P: conducts a port scan

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

More Like This

Use Quizgecko on...
Browser
Browser