nerdexam
CompTIA

PT0-002 · Question #48

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…

The correct answer is D. 1 UNION SELECT 1, DATABASE(),3--. The website is prone to a SQL injection attack as it appears to be taking the user input directly.

Attacks and Exploits

Question

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?

Options

  • A<script>var adr= `../evil.php?test=' + escape(document.cookie);</script>
  • B../../../../../../../../../../etc/passwd
  • C/var/www/html/index.php;whoami
  • D1 UNION SELECT 1, DATABASE(),3--

How the community answered

(61 responses)
  • A
    16% (10)
  • B
    5% (3)
  • C
    8% (5)
  • D
    70% (43)

Explanation

The website is prone to a SQL injection attack as it appears to be taking the user input directly.

Topics

#SQL Injection#Web Application Hacking#Database Exploitation#Error-based Injection

Community Discussion

No community discussion yet for this question.

Full PT0-002 Practice