ExamGecko
Home Home / CompTIA / PT0-002

CompTIA PT0-002 Practice Test - Questions Answers, Page 41

Question list
Search
Search

List of questions

Search

Related questions











After obtaining a reverse shell connection, a penetration tester runs the following command: www-data@server!2:sudo -1

User www-data may run the following commands on serverl2: (root) NOPASSWD: /usr/bin/vi

Which of the following is the fastest way to escalate privileges on this server?

A.
Editing the file /etc/passwd to add a new user with uid 0
A.
Editing the file /etc/passwd to add a new user with uid 0
Answers
B.
Creating a Bash script, saving it on the /tmp folder, and then running it
B.
Creating a Bash script, saving it on the /tmp folder, and then running it
Answers
C.
Executing the command sudo vi -c ' Jbash'
C.
Executing the command sudo vi -c ' Jbash'
Answers
D.
Editing the file/etc/sudoers to allow any command
D.
Editing the file/etc/sudoers to allow any command
Answers
Suggested answer: C

Explanation:

When the penetration tester has NOPASSWD privileges to run vi as root, the quickest way to escalate privileges is to leverage vi to execute a shell. The command sudo vi -c ':!bash' opens vi as the root user and immediately spawns a shell within vi. This method is fast and effective because vi (or vim) has the capability to run shell commands.

Executing sudo vi -c ':!bash' will open vi and then immediately run the :!bash command, which spawns a Bash shell with root privileges.

GTFOBins - vi

Example from penetration testing reports where vi is used to escalate privileges: Writeup.

SIMULATION

A penetration tester performs several Nmap scans against the web application for a client.

INSTRUCTIONS

Click on the WAF and servers to review the results of the Nmap scans. Then click on each tab to select the appropriate vulnerability and remediation options.

If at any time you would like to bring back the initial state of the simulation, please click the Reset All button.

A.
See the explanation part for detailed solution
A.
See the explanation part for detailed solution
Answers
Suggested answer: A

Explanation:

Most likely vulnerability: Perform a SSRF attack against App01.example.com from CDN.example.com.

The scenario suggests that the CDN network (with a WAF) can be used to perform a Server-Side Request Forgery (SSRF) attack. Since the penetration tester has the pentester workstation interacting through the CDN/WAF and the production network is behind it, the most plausible attack vector is to exploit SSRF to interact with the internal services like App01.example.com.

Two best remediation options:

Restrict direct communications to App01.example.com to only approved components.

Require an additional authentication header value between CDN.example.com and App01.example.com.

Restrict direct communications to App01.example.com to only approved components: This limits the exposure of the application server by ensuring that only specified, trusted entities can communicate with it.

Require an additional authentication header value between CDN.example.com and App01.example.com: Adding an authentication layer between the CDN and the app server helps ensure that requests are legitimate and originate from trusted sources, mitigating SSRF and other indirect attack vectors.

Nmap Scan Observations:

CDN/WAF shows open ports for HTTP and HTTPS but filtered for MySQL, indicating it acts as a filtering layer.

App Server has open ports for HTTP, HTTPS, and filtered for MySQL.

DB Server has all ports filtered, typical for a database server that should not be directly accessible.

These findings align with the SSRF vulnerability and the appropriate remediation steps to enhance the security of internal communications.

A penetration tester enters a command into the shell and receives the following output:

C:\Users\UserX\Desktop>vmic service get name, pathname, displayname, startmode | findstr /i auto | findstr /i /v |C:\\Windows\\' I findstr /i /v''

VulnerableService Some Vulnerable Service C:\Program Files\A Subfolder\B Subfolder\SomeExecutable.exe Automatic

Which of the following types of vulnerabilities does this system contain?

A.
Unquoted service path
A.
Unquoted service path
Answers
B.
Writable services
B.
Writable services
Answers
C.
Clear text credentials
C.
Clear text credentials
Answers
D.
Insecure file/folder permissions
D.
Insecure file/folder permissions
Answers
Suggested answer: A

Explanation:

* The provided output reveals a common vulnerability in Windows services known as an unquoted service path. When the service executable path is not enclosed in quotes and contains spaces, Windows may incorrectly interpret the spaces, potentially leading to the execution of unintended programs.

* Details:

Command The command vmic service get name, pathname, displayname, startmode | findstr /i auto | findstr /i /v 'C:\\Windows\\' | findstr /i /v '' filters services that are set to start automatically and are not located in the Windows directory.

Output Interpretation: The output shows a service with a path C:\Program Files\A Subfolder\B Subfolder\SomeExecutable.exe which is not quoted. If a malicious user places an executable in C:\Program.exe, C:\Program Files\A.exe, or similar, it might get executed instead.

*

Reference: Common Windows privilege escalation vulnerabilities include unquoted service paths. This vulnerability is well-documented in security resources and penetration testing guides.

A security consultant wants to perform a vulnerability assessment with an application that can effortlessly generate an easy-to-read report. Which of the following should the attacker use?

A.
Brakeman
A.
Brakeman
Answers
B.
Nessus
B.
Nessus
Answers
C.
Metasploit
C.
Metasploit
Answers
D.
SCAP
D.
SCAP
Answers
Suggested answer: B

Explanation:

Nessus is a comprehensive vulnerability assessment tool that is widely used for conducting vulnerability assessments. It is known for its ability to generate detailed and easy-to-read reports, which makes it a preferred choice for security consultants who need to document their findings clearly.

Nessus scans for a wide range of vulnerabilities across different systems and applications. It provides a detailed report that includes the vulnerabilities found, their severity levels, and recommendations for remediation. This feature makes it ideal for security consultants who need to perform vulnerability assessments and present their findings to stakeholders in an understandable format.

Nessus product page: Tenable Nessus

Use of Nessus in penetration testing reports: The reports generated by Nessus have been referenced in various HTB writeups such as those for Luke and Horizontall.

A penetration tester is attempting to perform reconnaissance on a customer's external-facing footprint and reviews a summary of the fingerprinting scans:

SSH servers: 23

NTP servers: 4

Rsync servers: 5

LDAP servers: 2

Which of the following OSs is the organization most likely using?

A.
Mac OS X
A.
Mac OS X
Answers
B.
FreeBSD
B.
FreeBSD
Answers
C.
Microsoft Windows
C.
Microsoft Windows
Answers
D.
Linux
D.
Linux
Answers
Suggested answer: B

Explanation:

The presence of specific services like SSH, NTP, Rsync, and LDAP servers is indicative of a Unix-like operating system. Among the given options, FreeBSD is the most likely operating system that would be running all these services. FreeBSD is known for its robustness and extensive use in environments requiring stable and secure networking services.

Given the context of penetration testing and the enumeration of these services, FreeBSD's configuration and service management fit well with the identified services. Other operating systems listed (Mac OS X, Microsoft Windows, Linux) might not typically run all these services in a similar configuration, particularly NTP and Rsync, which are more common in Unix-like systems.

FreeBSD documentation on NTP and Rsync: FreeBSD Handbook, FreeBSD Rsync

Enumeration examples from HTB writeups such as Gobox and Writeup which often lead to identifying specific OS based on running services.

During an assessment, a penetration tester obtains a list of password digests using Responder. Which of the following tools would the penetration tester most likely use next?

A.
Hashcat
A.
Hashcat
Answers
B.
Hydra
B.
Hydra
Answers
C.
CeWL
C.
CeWL
Answers
D.
Medusa
D.
Medusa
Answers
Suggested answer: A

Explanation:

When a penetration tester obtains a list of password digests using Responder, the next logical step is to attempt to crack these password hashes to retrieve the plaintext passwords. Hashcat is one of the most widely used tools for this purpose. It is a high-performance password recovery tool that supports a wide range of hashing algorithms and can utilize the power of GPU acceleration to significantly speed up the cracking process.

Hashcat is preferred over tools like Hydra, CeWL, and Medusa in this context because it is specifically designed for cracking password hashes rather than brute-forcing login credentials (Hydra, Medusa) or generating custom wordlists (CeWL).

Hashcat official website: Hashcat

Usage examples in various penetration testing reports, including those involving password cracking and hash manipulation.

During an assessment, a penetration tester needs to perform a cloud asset discovery of an organization. Which of the following tools would most likely provide more accurate results in this situation?

A.
Pacu
A.
Pacu
Answers
B.
Scout Suite
B.
Scout Suite
Answers
C.
Shodan
C.
Shodan
Answers
D.
TruffleHog
D.
TruffleHog
Answers
Suggested answer: B

Explanation:

Scout Suite is an open-source multi-cloud security-auditing tool that enables security posture assessment of cloud environments. It is designed to provide a comprehensive and accurate analysis of cloud assets by using the APIs of cloud service providers. Scout Suite supports major cloud platforms, including AWS, Azure, and GCP, making it suitable for performing cloud asset discovery.

Other tools listed, such as Pacu, Shodan, and TruffleHog, serve different purposes. Pacu is a cloud exploitation framework for AWS, Shodan is a search engine for internet-connected devices, and TruffleHog is a tool for searching for secrets in files. While they are valuable tools, Scout Suite is specifically tailored for comprehensive cloud asset discovery.

Scout Suite GitHub page: Scout Suite

Cloud security auditing examples from penetration testing reports and best practices.

A penetration tester managed to get control of an internal web server that is hosting the IT knowledge base. Which of the following attacks should the penetration tester attempt next?

A.
Vishing
A.
Vishing
Answers
B.
Watering hole
B.
Watering hole
Answers
C.
Whaling
C.
Whaling
Answers
D.
Spear phishing
D.
Spear phishing
Answers
Suggested answer: B

Explanation:

A watering hole attack involves compromising a website that is frequently visited by the target organization or group. By gaining control of the internal web server hosting the IT knowledge base, a penetration tester could modify the content or introduce malicious code that would be downloaded or executed by employees who visit the site. This type of attack is effective because it leverages a trusted resource within the organization to spread malware or capture sensitive information.

Other options like vishing, whaling, and spear phishing involve direct social engineering attacks targeting individuals, whereas a watering hole attack leverages a compromised website to target multiple users within the organization.

Explanation of watering hole attacks: OWASP Watering Hole

Examples from penetration testing engagements where web server compromises were used to conduct watering hole attacks.

A penetration tester wants to perform a SQL injection test. Which of the following characters should the tester use to start the SQL injection attempt?

A.
Colon
A.
Colon
Answers
B.
Double quote mark
B.
Double quote mark
Answers
C.
Single quote mark
C.
Single quote mark
Answers
D.
Semicolon
D.
Semicolon
Answers
Suggested answer: C

Explanation:

The single quote mark (') is a common character used to test for SQL injection vulnerabilities. This character is often used to terminate a string in SQL queries. By injecting a single quote mark into an input field, a penetration tester can determine whether the application is susceptible to SQL injection based on the resulting error messages or behavior of the application.

The single quote mark is typically used first because it is straightforward and effective in revealing SQL injection flaws. Other characters like double quotes or semicolons might also be useful in specific contexts, but the single quote is the standard starting point for SQL injection testing.

OWASP SQL Injection Guide: OWASP SQL Injection

Demonstrations of SQL injection techniques in various penetration testing scenarios.

Which of the following is the most secure way to protect a final report file when delivering the report to the client/customer?

A.
Creating a link on a cloud service and delivering it by email
A.
Creating a link on a cloud service and delivering it by email
Answers
B.
Asking for a PGP public key to encrypt the file
B.
Asking for a PGP public key to encrypt the file
Answers
C.
Requiring FTPS security to download the file
C.
Requiring FTPS security to download the file
Answers
D.
Copying the file on a USB drive and delivering it by postal mail
D.
Copying the file on a USB drive and delivering it by postal mail
Answers
Suggested answer: B

Explanation:

* Using PGP (Pretty Good Privacy) encryption ensures that the report file is securely encrypted with the client's public key. Only the client can decrypt the file using their private key, ensuring confidentiality during transit.

* Details:

Option Analysis:

A . Creating a link on a cloud service and delivering it by email: This method is susceptible to interception or unauthorized access.

B . Asking for a PGP public key to encrypt the file: Provides end-to-end encryption ensuring that only the intended recipient can access the file.

C . Requiring FTPS security to download the file: While secure, it does not provide the same level of end-to-end encryption as PGP.

D . Copying the file on a USB drive and delivering it by postal mail: While physically secure, it is not practical and poses a risk of loss or theft.

*

Reference: PGP encryption is a widely accepted method for securing sensitive data. It is recommended by many cybersecurity standards and best practice guides.

Total 422 questions
Go to page: of 43