exam questions

Exam PT0-002 All Questions

View all questions & answers for the PT0-002 exam

Exam PT0-002 topic 1 question 147 discussion

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

A tester who is performing a penetration test on a website receives the following output:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /var/www/search.php on line 62
Which of the following commands can be used to further attack the website?

  • A. <script>var adr = '../evil.php?test=' + escape(document.cookie);</script>
  • B. ../../../../../../../../../../etc/passwd
  • C. /var/www/html/index.php;whoami
  • D. 1 UNION SELECT 1, DATABASE (), 3 --
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
ryanzou
Highly Voted 2 years, 5 months ago
Selected Answer: D
D SQL
upvoted 7 times
...
Etc_Shadow28000
Most Recent 8 months, 1 week ago
Selected Answer: D
The error message mysql_fetch_array() expects parameter 1 to be resource, boolean given indicates a potential SQL injection vulnerability in the website’s search.php script. The appropriate command to further attack the website would be: D. 1 UNION SELECT 1, DATABASE(), 3 -- Explanation: • SQL Injection: The error message suggests that the application is trying to fetch data from a MySQL database, and it may be vulnerable to SQL injection. The UNION SELECT statement is used to combine the results of two or more SELECT statements. By injecting 1 UNION SELECT 1, DATABASE(), 3 --, the tester is attempting to exploit the SQL injection vulnerability to extract the name of the current database.
upvoted 1 times
...
matheusfmartins
1 year, 7 months ago
Selected Answer: D
It was presented a SQL error, so the pentester should try to perform a SQL Injection attack.
upvoted 1 times
...
nickwen007
2 years ago
The command that can be used to further attack the website is D. 1 UNION SELECT 1, DATABASE (), 3 --. This command is used to determine databases and tables in a SQL injection attack. The warning message indicates there may be a potential vulnerability in the /var/www/search.php file. Command A <script>var adr = '../evil.php?test=' + escape(document.cookie);</script> is used to inject malicious JavaScript code into a website, while command B ../../../../../../../../../../etc/passwd is used to read system files. Finally, command C /var/www/html/index.php;whoami is used to view information
upvoted 4 times
...
nickwen007
2 years ago
The command that can be used to further attack the website is D. 1 UNION SELECT 1, DATABASE (), 3 --. This is an example of an exploitation technique known as 'sql injection', where malicious SQL commands are inserted into user input fields in order to access confidential information or modify the contents of a database.
upvoted 4 times
...
kloug
2 years ago
ddddddd
upvoted 3 times
...
2Fish
2 years, 1 month ago
Selected Answer: D
Thinking D. Here is more context. https://www.examtopics.com/discussions/comptia/view/66786-exam-pt1-002-topic-1-question-99-discussion/
upvoted 4 times
...
NotAHackerJustYet
2 years, 1 month ago
Selected Answer: D
Answer: D. 1 UNION SELECT 1, DATABASE (), 3 -- Explanation: The output from the tester's penetration test indicates an issue with the mysql_fetch_array() command in the search.php file. This means that the tester is trying to access a MySQL database. Option D is the correct command to further attack the website since it is a SQL injection attack that can be used to access the database. Option A is incorrect since it is an example of a Cross-site Scripting (XSS) attack, which is not relevant to the output of the tester's penetration test. Option B is incorrect since it is a command to access the password file on the server, which is not relevant to the output of the tester's penetration test. Option C is incorrect since it is a command to execute a PHP script, which is not relevant to the output of the tester's penetration test.
upvoted 3 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