31. Which of the following attacks is being attempted?

Answer: C

Explanation:

Directory traversal

The logs indicate an attempt to access sensitive files on the web server using directory traversal techniques, specifically targeting the `/etc/passwd` and `/etc/shadow` files.

A) File injection

File injection typically involves uploading malicious files to a server or manipulating file paths to execute code. While the logs reference file paths, the primary technique in use here is not injection but rather navigating the directory structure to access restricted files.

B) Privilege escalation

Privilege escalation refers to exploiting a vulnerability to gain higher access levels than intended. The logs do not indicate any attempts to elevate privileges but instead show a direct attempt to access files that should be restricted, which does not align with privilege escalation.

C) Directory traversal

This option is correct as it describes the technique being used in the logs. The attacker is attempting to access sensitive system files by manipulating the URL to traverse directories, specifically using `../../../` to navigate to parent directories and access `/etc/passwd` and `/etc/shadow`.

D) Cookie forgery

Cookie forgery involves creating false cookies to impersonate a user or gain unauthorized access. The logs do not mention any cookie manipulation or attempts to exploit session management, making this option irrelevant to the context presented.

Conclusion

The correct answer, directory traversal, accurately describes the attack method reflected in the logs, where the attacker is attempting to access unauthorized files by traversing the directory structure. Other options fail to capture the specific nature of the attempted attack, as they pertain to different types of exploitation not evidenced in the provided extract.