Jump to content
co4ie

Anatomy of an RFI/LFI Attack

Recommended Posts

Anatomy of an RFI/LFI Attack

In yesterday's blog, we described how an RFI/LFI attack worked in the case of militarysingles.com. How do they work in general? Today's blog attempts to describe how these attacks works in the wild. We will show how malicious code can be uploaded to the server. Our hope from this exercise?

6a01156f8c7ad8970c01676471f5a3970b-320wi

Step 1: Take an innocent jpg image and some malicious code:

6a01156f8c7ad8970c0167647272fb970b-320wi

Why pictures? Because many sites (such as militarysingles) allow only picture upload and no other file types. Here's a malicious code example:

6a01156f8c7ad8970c01676472731d970b-800wi

This specific code was used to find vulnerable servers to RFI and would likely get detected by most anti-virus packages available today. This simple code instructs the server to concatenate the strings “FeeL” and “CoMz” in both the ‘echo’ and ‘die’ functions, write the strings back to the user and exit the current script. If the user will see these strings in the response from the server, he can know that the server is vulnerable to RFI.

Step 2: Copy and paste the malicious code in the Camera maker property:

6a01156f8c7ad8970c016764727db5970b-800wi

Step 3: Load the infected image to a web server.

Step 4: Use the URL of the infected image as an input to the vulnerable server:

6a01156f8c7ad8970c016764727edb970b-800wi

Note the ‘FeeLCoMzFeeLCoMz’ output received from the server. In order to have better immunity to anti-virus software, one can modify step 2:

6a01156f8c7ad8970c016764727f3b970b-800wi

What was done? You divide the malicious code into two parts. Paste one part in the Camera maker property and the second part in the Camera model property. This will produce the same infection as before--with zero antivirus detection. Also, the picture still look benign to the eye and valid from the technical point of view.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...