What is this file in .htaccess?

15,743

Solution 1

UPDATE: This answer was based on speculation using the facts provided when it was originally posted. The overall consensus seems to be this modification of the .htaccess file is most likely the result of using server management software such as CPanel so it’s not—on its own—an indication of malware infection.

The contents of that .htaccess are a bit odd.

<Files 403.shtml>
order allow, deny
allow from all
</Files>

deny from 212.92.53.18

The <Files 403.shtml> part refers to the 403.shtml file and it seems to be allowing a custom 403: Forbidden response (assumption based on file naming) .shtml file to be sent. The order allow, deny and related allow from all explain it to me. It seems like the site is blocking all traffic in some way but wants that 403.shtml to come through?

But the deny from 212.92.53.18 is quite specific & odd as a result. That is basically blocking any/all access from 212.92.53.18.

Now typing that out it seems like the .htaccess is set to explicitly deny access from address 212.92.53.18 which would send a 403 response code, and the <Files 403.shtml> allows the actual 403: Forbidden htaccess page to be sent?

But still, it seems odd for a directive to block traffic from one single IP address would be in an .htaccess file like that.

EDIT: Did a Google search for <Files 403.shtml>—because if you know Apache configs, that is a highly odd directive—and it seems like this might be part of some malware? Look at this page as well as this page and this other page.

Seems like this is part of a definite XSS backdoor? Perhaps the .htaccess is in a malware directory, and the deny from 212.92.53.18 is denying the infected server from accessing itself?

ANOTHER EDIT: Okay, putting on my thinking cap—as well as personal experience with web malware—and looking at the specificity of the deny from 212.92.53.18 I think I know what the deal is. This is part of a malware infection. But I bet that 212.92.53.18 is a node on a bonnet because you can curl -I it & visit it in a browser & it seems to be an active server. Most client IP addresses just won’t do that; who has a web server exposed on a basic ISP connection, right? Unless the machine is infected. So the 403.shtml is not actually a real 403: Forbidden page but actually part of the malware. Meaning, a connection being made FROM 212.92.53.18 would trigger 403.shtml—which is a server side include HTML file—that could be used for unauthorized access. I mean, when has anyone in 2014 last seen active .shtml files on legit servers, right? It’s all PHP, Python, Java or Ruby nowadays.

Solution 2

It is not definitely malware.

At least, not in the sense it's intended for malicious reasons...

In the case you are using cpanel and you have used its IP Deny Manager to block access to 212.92.53.18 then this will automatically be written to your .htaccess file with the intended purpose of blocking that IP (and any others you may wish to enter):

<Files 403.shtml>
order allow, deny
allow from all
</Files>

deny from 212.92.53.18

Do you use cpanel and if so, do you remember doing that?

Solution 3

Allowing the 403 to All simply prevents a loop. If you block an IP using the 'deny from' method, then serving of the 403 to that IP would also get blocked, creating a loop. Allowing the specific 403 file to ALL, will override the block -- of serving the 403 to that specific IP -- that otherwise would have occurred. That prevents a loop.

Solution 4

<Files 403.shtml>
order allow, deny
allow from all
</Files>

I used it myself on an old domain. It simply says "allow anyone to access the file named 403.shtml"; which is the forbidden access error. Of course, you would use this usually if you created a custom 403.shtml page.

The denied IP in this case would not see the custom 403.shtml and instead would get a White-screen-of-death.

So this is not, in any way shape or form, malware related.

Solution 5

This?

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from  xx.xx.xx.xx

Hacker? Backdoor? Malware? Ukraninian DOS attack?

Of course it IS NOT. It's nothing of the sort.

It is automatically generated by cPanel, when the "IP Blocker" is used. cPanel writes it to your .htaccess file

The 'deny from' is simply the IP specified when using the cPanel IP Blocker tool. cPanel is clever enough to know a little more is needed than just a simple 'deny' IP4 entry.

Share:
15,743
SopheakVirak
Author by

SopheakVirak

I just want to learn and find job to do.

Updated on June 04, 2022

Comments

  • SopheakVirak
    SopheakVirak almost 2 years

    I am realy wonder why in .htaccess has those code bellow, can tell me what is this code?

    <Files 403.shtml>
    order allow, deny
    allow from all
    </Files>
    
    deny from 212.92.53.18
    
  • FluffyKitten
    FluffyKitten over 7 years
    This is is no way a sure sign of an attack, as others have stated below. In fact, the IP Deny Manager in CPanel added this exact code to my .htaccess when I used it to block an IP address.
  • user339568
    user339568 almost 7 years
    I had this in some of my .htaccess files, and was wondering what it was, and this answer definitely got me worried a bit. Turns out it was cPanel IP deny manager, just like @FluffyKitten said, it aded this exact code for me as well.
  • FluffyKitten
    FluffyKitten almost 7 years
    @JakeGould - as you rejected my edit, can I suggest that you change your answer yourself to reflect that this is NOT definitely malware as you assert. Other answers below prove that this can in fact be a VALID entry in .htaccess. My edit was nothing to do with readability - it was to fix incorrect and misleading information in your answer.