Publicly accessible config, backup, or log file found: .user.ini
-
I have this error message when I scan my site : Publicly accessible config, backup, or log file found: .user.ini
Actually it is true, this .user.ini file is located inside public_html folder.
I tried to delete it but then when I click to setup the firewall, the file gets back.
I don’t understand. Could you please tell me how I can get rid of this critical error ?
Thanks
-
Hi @bmontgomery, I should be able to assist with that.
When you optimize the Wordfence firewall on some configurations/servers it uses .user.ini rather than .htaccess. If it’s publicly accessible, are you able to use the “HIDE FILE” option offered to you in the scan results? This will usually add some code to your .htaccess to make sure it isn’t visible or downloadable in future.
If there’s a problem writing that, you could add the following to the top of your .htaccess file manually to see if it helps:
# Wordfence WAF <Files ".user.ini"> <IfModule mod_authz_core.c> Require all denied </IfModule> <IfModule !mod_authz_core.c> Order deny,allow Deny from all </IfModule> </Files> # END Wordfence WAF
Many thanks,
Peter.Thanks Peter,
It seems that these lines are already inside my .htaccess, but at the end of the file.
Here’s my .htaccess file :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/?\.user\.ini$
RewriteRule .* - [F,L,NC]
</IfModule>
<IfModule !mod_rewrite.c>
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
</IfModule>
# BEGIN WpFastestCache
# Modified Time: 06-07-23 17:56:34
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^mysite.fr
# Start WPFC Exclude
# End WPFC Exclude
# Start_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=admin1|admin2
# End_WPFC_Exclude_Admin_Cookie
RewriteCond %{HTTP_HOST} ^mysite.fr
RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WP_FASTEST_CACHE_CSS_VALIDATOR|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot)
RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot)
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{REQUEST_URI} !(\/){2,}
RewriteCond %{THE_REQUEST} !(\/){2,}
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{QUERY_STRING} !.+
RewriteCond %{HTTP:Cookie} !wordpress_logged_in
RewriteCond %{HTTP:Cookie} !comment_author_
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
RewriteCond /var/www/html/sites/mysite/public_html/wp-content/cache/all/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
</IfModule>
<FilesMatch "index\.(html|htm)$">
AddDefaultCharset UTF-8
<ifModule mod_headers.c>
FileETag None
Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT"
</ifModule>
</FilesMatch>
# END WpFastestCache
# BEGIN LBCWpFastestCache
<FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|avif|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|otf|ttf|svg|eot)(\.gz)?$">
<IfModule mod_expires.c>
AddType application/font-woff2 .woff2
AddType application/x-font-opentype .otf
ExpiresActive On
ExpiresDefault A0
ExpiresByType video/webm A10368000
ExpiresByType video/ogg A10368000
ExpiresByType video/mp4 A10368000
ExpiresByType image/avif A10368000
ExpiresByType image/webp A10368000
ExpiresByType image/gif A10368000
ExpiresByType image/png A10368000
ExpiresByType image/jpg A10368000
ExpiresByType image/jpeg A10368000
ExpiresByType image/ico A10368000
ExpiresByType image/svg+xml A10368000
ExpiresByType text/css A10368000
ExpiresByType text/javascript A10368000
ExpiresByType application/javascript A10368000
ExpiresByType application/x-javascript A10368000
ExpiresByType application/font-woff2 A10368000
ExpiresByType application/x-font-opentype A10368000
ExpiresByType application/x-font-truetype A10368000
</IfModule>
<IfModule mod_headers.c>
Header set Expires "max-age=A10368000, public"
Header unset ETag
Header set Connection keep-alive
FileETag None
</IfModule>
</FilesMatch>
# END LBCWpFastestCache
# This file was updated by Duplicator on 2023-07-04 14:59:51.
# See the original_files_ folder for the original source_site_htaccess file.
# BEGIN WordPress
# Les directives (lignes) entre ??BEGIN WordPress?? et ??END WordPress?? sont générées
# dynamiquement, et doivent être modifiées uniquement via les filtres WordPress.
# Toute modification des directives situées entre ces marqueurs sera surchargée.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# Wordfence WAF
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order deny,allow
Deny from all
</IfModule>
</Files>
# END Wordfence WAFAny idea why it’s not working ?
Hi @bmontgomery,
The same code has been effectively added at the top either manually, automatically as part of your site setup, or by another plugin – just with a rewrite rule above it. That rule though should effectively result in blocking access to .user.ini in a browser for your site regardless of the duplicate Wordfence code at the bottom.
Whilst I don’t think I need to look into how Wordfence is configured, you could send us a diagnostic report so I can try to access the file myself to see what might be going wrong. This method just ensures you don’t need to share your domain publicly here in order for me to test. You can do this from Wordfence > Tools > Diagnostics to us at wftest @ wordfence . com. Click on “Send Report by Email”. Please add your forum username where indicated and respond here after you have sent it.
NOTE: It should look as follows – Screenshot of Tools > Diagnostic > Send by Email
Many thanks,
Peter.Hello Peter,
Sorry for the delay in my answer.
I just send you the report.
I hope you’ll be able to help me solve this issue… Thanks.
Hello Peter, did you receive the report I sent you ?
Could you please tell me what I can do now because I’m still stuck with this issue…
Thanks for your help.
- You must be logged in to reply to this topic.