312-50V13 practice question 17 of 35

By performing a penetration test, you gained access under a user account. During the test, you established a connection with your own machine via the SMB service and occasionally entered your login and password in plaintext. Which file do you have to clean to clear the password?

Full set: 573 questions

Domain System Hacking Phases and Attack Techniques

Answer options
A: .X session-log
B: .bashrc
C: .profile
D: .bash_history Correct answer
Correct Answer:
D. .bash_history
Explanation

The .bashhistory file, located in a user's home directory, is the default file used by the Bash shell to log the commands executed by that user. When a user types a command that includes sensitive information in plaintext, such as a password for an SMB connection (smbclient //server/share -U user%password), the entire command string is saved in this file. To remove evidence of this action and the exposed password, a penetration tester must edit or clear the contents of the .bashhistory file. This is a critical step in post-exploitation cleanup.

Why Incorrect

A. .Xsession-log: This file logs output and errors from the X Window System session startup, not the user's interactive shell commands.
B. .bashrc: This is a shell script that contains user-specific configurations and functions that are executed when an interactive Bash shell starts.
C. .profile: This is a configuration file executed for login shells, primarily used to set environment variables for the user's session.

References

1. GNU Project

Bash Reference Manual. Section 8.2

"Bash History Facilities

" specifies that when an interactive shell exits

the command history is saved to the file designated by the HISTFILE variable

which defaults to ~/.bashhistory.

Source: Free Software Foundation

Inc. (2022). Bash Reference Manual

for Bash version 5.2. Section 8.2. Retrieved from https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-History-Facilities

2. Carvey

H. (2012). Windows Forensic Analysis Toolkit

Fourth Edition. While focused on Windows

Chapter 1 discusses attacker methodologies

including covering tracks. The principle of clearing command history is a universal concept in digital forensics and post-exploitation

with .bashhistory being the direct Linux equivalent of the artifacts discussed. The CEH curriculum covers both Windows and Linux environments.

Source: Carvey

H. (2012). Windows Forensic Analysis Toolkit

Fourth Edition. Syngress. (Principle of clearing command history as a post-exploitation step).

3. University of California

Berkeley

CS 161: Computer Security. Course materials on system security and forensics frequently identify shell history files as a primary artifact for investigators. Lecture notes and labs emphasize that files like .bashhistory contain a chronological record of a user's command-line activity

making them a key target for both attackers to clean and defenders to analyze.

Source: University of California

Berkeley. CS 161: Computer Security

Lecture 20: "Forensics". (Discusses system artifacts

including shell history).

Scroll to Top