Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 11th Nov 2013, 04:49 AM   #1
SKT Wordpress Themes
War Room Member
 
sktthemes's Avatar
 
Join Date: 2013
Location: Nagpur
Posts: 65
Thanks: 5
Thanked 28 Times in 11 Posts
Default
Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

Okay i have a website sktthemes.net and it keeps on coming under fire from hackers in Turkey.

Now how do i know?

Quite simple my site is in wordpress and i have better wp security plugin installed.

So it keeps on sending me emails about ip getting locked due to too many login attempts.

IPs are: 78.160.130.138, 95.10.161.141 and so on many like 20 in a day.

If you trace those IPs all come from Turkey.

My question is very simple. I need to know how to block all admin access for IPs other than Indian IPs where we are so that such kind of hacking attempts don't happen.

Sorry for such a long post/thread.

sktthemes is offline  
Unread 11th Nov 2013, 09:01 AM   #2
Active Warrior
War Room Member
 
Join Date: 2010
Posts: 45
Thanks: 0
Thanked 8 Times in 4 Posts
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

you can try adding something like this to your .htaccess file

Code:
RewriteCond %{REMOTE_ADDR} !^93.89.95.250$
RewriteCond %{REQUEST_URI} (wp-admin)
RewriteRule (.*) / [NC,QSA,L]
Obviously replace the ip with your ip. Basically what the rul says: if the user's ip is not the one given and the url contains "wp-admin" redirect the user to the main page

If you have dynamic ip address you can do stuff like !^93.89.\d+.\d+ to allow certain ranges
lepunk is offline  
The Following 2 Users Say Thank You to lepunk For This Useful Post:
Unread 12th Nov 2013, 06:03 AM   #3
SKT Wordpress Themes
War Room Member
 
sktthemes's Avatar
 
Join Date: 2013
Location: Nagpur
Posts: 65
Thanks: 5
Thanked 28 Times in 11 Posts
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

Awesome thanks for your valuable suggestion

sktthemes is offline  
Unread 16th Nov 2013, 08:02 AM   #4
ɹoıɹɹɐʍ ǝʌıʇɔɐɹǝdʎɥ
War Room Member
 
RobinInTexas's Avatar
 
Join Date: 2008
Location: Texas
Posts: 2,138
Thanks: 243
Thanked 453 Times in 382 Posts
Blog Entries: 3
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

Rather than sending the miscreant to another place on your site, or anywhere else for that matter, I prefer sending them back to themselves.

RewriteCond %{REMOTE_ADDR} !^93.89.95.250$
RewriteCond %{REQUEST_URI} .wp-login.php\.php*
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

Robin


...Even if you're on the right track, you'll get run over if you just set there.
RobinInTexas is offline  
Unread 16th Nov 2013, 11:41 PM   #5
Active Warrior
War Room Member
 
Join Date: 2013
Posts: 49
Thanks: 3
Thanked 6 Times in 6 Posts
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

Here is the way to do it:
Go to wp-login.php using FTP, add this line directly below <?php
Code:
if ($_GET['admincode']==128364){
and add
Code:
}
below
Code:
require( dirname(__FILE__) . '/wp-load.php' );
So the top of the file should look like this:
Code:
<?php
if ($_GET['admincode']==128364)
{
/**
 * WordPress User Page
 *
 * Handles authentication, registering, resetting passwords, forgot password,
 * and other user handling.
 *
 * @package WordPress
 */

/** Make sure that the WordPress bootstrap has run before continuing. */
require( dirname(__FILE__) . '/wp-load.php' );
}
To gain access to the login page, add ?admincode=128364 after the URL, so it will look like this:
Code:
http://yourwebsite.com/wp-login.php?admincode=128364
What is does is that it blocks the server's access to wp-load.php if the admincode attribute is incorrect, therefore no login forms will be displayed. Of course you can change the code to something you like.
Hope it helps!
Nett is offline  
The Following User Says Thank You to Nett For This Useful Post:
Unread 17th Nov 2013, 08:35 PM   #6
Active Warrior
 
MrLeN's Avatar
 
Join Date: 2008
Location: , , Australia.
Posts: 42
Thanks: 5
Thanked 4 Times in 4 Posts
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

Or, you could make the page only show up if your IP is detected:

Code:
$admin_ip = "123.456.789.123";
if ($_SERVER["REMOTE_ADDR"] != $admin_ip ) {
  echo "get lost turkey head!";
  exit;
}
Just put that line at the top of the template... will fix all problems in 1 second
MrLeN is offline  
Unread 17th Nov 2013, 09:16 PM   #7
ɹoıɹɹɐʍ ǝʌıʇɔɐɹǝdʎɥ
War Room Member
 
RobinInTexas's Avatar
 
Join Date: 2008
Location: Texas
Posts: 2,138
Thanks: 243
Thanked 453 Times in 382 Posts
Blog Entries: 3
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

BAD ADVICE

Originally Posted by Nett View Post

Here is the way to do it:
Go to wp-login.php using FTP, add this line directly below
x---------snip-------------x
It's always a bad practice to edit wordpress core files for any reason.

I would give you 2 suggestions, my preference would be to use Wordfence plugin to guard against unwanted logins as it gives you the ability to better control login attempts, including giving you the ability to immediately lock out an IP after the first attempt to login with an invalid user name.
In the alternative you could deselect having Better WP Security send notifications that it is doing its job and locking the bad guys out.

I have done the same with Wordfence, I don't feel the need to be reminded that miscreants are trying unsuccessfully to log in to my sites.

Robin


...Even if you're on the right track, you'll get run over if you just set there.
RobinInTexas is offline  
Unread 21st Nov 2013, 11:31 AM   #8
Active Warrior
War Room Member
 
Join Date: 2010
Posts: 45
Thanks: 0
Thanked 8 Times in 4 Posts
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

I can't believe that SQL injection is still something you have to worry about in 2013.
PDO has been around for ages and everyone should use it.

Why is this still a problem?
- Some shared hosts don't have compiled PDO so script developers need to use mysql_* or mysqli instead
- If you google "php mysql tutorial" this comes up: PHP MySQL Insert Into See the problem? Most people learns using PHP and mySQL based on this (sigh)

Thank god the mysql_* library will be completely deprecated in 5.5, hopefully the madness will end
lepunk is offline  
Unread 26th Nov 2013, 02:22 PM   #9
Warrior Member
 
Join Date: 2013
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

This looks very interesting, definately worth to take a look to wp security part
MichaelLamb is offline  
Unread 26th Nov 2013, 02:22 PM   #10
Warrior Member
 
Join Date: 2013
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Default
Re: Website hacking problem how to block admin access
Share on: 
fb share twitter share gplus share more share

This looks very interesting, definately woth to take a look to the wp security part.

Sorry duplicated post.
MichaelLamb is offline  
Closed Thread


Bookmarks

Tags
access, admin, block, block admin access, hacking, problem, website


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 11:39 PM.