New York Design & Development Forums  

Go Back   New York Design & Development Forums > Knowledge Bank > Tutorials
Connect with Facebook

Notices

Reply
 
LinkBack Thread Tools
Old 12-17-2006, 03:57 PM   #1 (permalink)
Taz
Junior Member
Newb
 
Taz's Avatar
 
Join Date: Dec 2006
Posts: 10
Taz will become famous soon enough
Lightbulb Dynamic IP Locking: A Poor Mans Multi-factor Authentication

Dynamic IP locking: A poor mans multi-factor Authentication

As some people know financial institutions have to implement Multi-factor authentication. FIL-103-2005

"What is Multi-Factor?
The authentication factors for humans are generally classified into three cases:

* Something the user is (e.g., fingerprint or retinal pattern, DNA sequence (there are assorted definitions of what is

sufficient), voice pattern (again several definitions), signature recognition, unique bio-electric signals produced by the

living body, or other biometric identifier)
* Something the user has (e.g., ID card, security token, software token or cell phone)
* Something the user knows (e.g., a password, a pass phrase or a personal identification number (PIN))"-wikipedia

So what if you want to implement multi-factor authentication for your simple website and not have to pay for commercial solutions? One that is as easy to use as CAPTCHA that recently sites have implemented.

I present Dynamic IP locking. Which is simply the concept of only allowing login if the user's ip (something they have) matches the one on record.

In the security world there has always been the practice to deny hosts unless they were of a certain IP. However, the problem is that now days on the internet hosts need to access systems and their ips are not fixed. The idea is to put into place a logon system that adds a level of security but by no means is a cure-all. IPs can still be forged just like we use MAC to deny hosts even though they can be spoofed. Your login protocol still checks for a user id and a password while looking if the ip that they signed up with matches the one signing on. So a normal fixed IP person would use their IP. However, a dynamic ip user would enter Whatever.dyndns.com or whaetver.com. The server then would look up the ip of this sub domain and see if it matches the host. The host would be running with in the background a client (https://www.dyndns.com/support/clients/) that
sends their dynamic ip to the trusted third party DNS providers like no-ip.com and etc. Also with the release of Windows Vista all users will be able to be given a ipv6 address with its own sub domain to use from Microsoft called the "Windows Internet Computer Name"-- a unique domain name. This can be treated as a trusted third party. The attackers thus could still forge the address; however he would have to know the sub domain to look up to spoof to the server.

This Dynamic IP locking would not be the only validation the user would still have to match USER ID, PASSWORD, IP checking.

However to the user this would not be an extra step once a client was running in the background reporting the ip to a trusted third party.

One of the main benefits is that current brute forcing software would not have this factor built in for their password cracking attempts. Some might think this would cause problems if a user went to a library and didn't have that Ip allowed to log in. You still can login to your third party and update your Ip to the current place of login. Of course if login in on an untrusted machine you will be exposing yourself. If a third party Dynamic DNS provider was DOSed logins would fail with multiple systems.

At its simplest form the php code would look like this. Of course in actual implantation you your software would be more complex. A non production example of a login with Dynamic Ip locking is at the bottom.
Code:
 
<?php

$ip = gethostbyname('zat.isa-geek.com');


If ($ip ==$_SERVER["REMOTE_ADDR"]){
echo "success";
}else {
echo "fail";
}


?>
It is also best to have this as an option to enable instead of being forced just like AOL users were given the option to use SecureID but not required.


People could just hack into the site you use for your dynamic dns, but then they would have to know which one you use.

If wanting to get into say your message board account they would have to know where your dynamic dns is and crack into an additional pair on login password combination.


The following is example code only and SHOULD NOT be used in production.
Code:
 
<form method="post" action="http://whatever.com/iplogon.php">


<input name="user" type="text">
<input name="pw" type="password">
<input type=submit value="Submit" >

</form>
This is a simple form to use to submit to our php script.


Now we create the mysql entries we will pull. Meow: is user id and password is password. Moo also has the password “password. Zat.isa-ageek.com is the location you want script to look up ip on the hostname.

Code:
#
# Table structure for table `users90`
#

CREATE TABLE `users90` (
 `username` varchar(99) NOT NULL default '',
 `password` varchar(99) NOT NULL default '',
 `ip` varchar(255) NOT NULL default ''
) TYPE=MyISAM;

#
# Dumping data for table `users90`
#

INSERT INTO `users90` VALUES ('meow', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 'zat.isa-geek.com');
INSERT INTO `users90` VALUES ('moo', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', '127.0.0.1');
   #


<?php
if ($REQUEST_METHOD=="POST") {
check();
}else{
}
function check()
{
mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
array_pop($_POST);
if ( get_magic_quotes_gpc() ) {
  $_POST= array_map('stripslashes', $_POST);
stripslashes($_REQUEST['pw']);
}
$username= mysql_real_escape_string(trim($_POST['user']));
$password= mysql_real_escape_string(trim($_REQUEST['pw']));
// I used request because when I was testing the post was coming up empty
$sha1pwd= sha1($password);

$sql= sprintf("SELECT COUNT(*) AS login_match FROM `users90` WHERE
`username` = '%s' AND `password`= '%s'", $username, $sha1pwd);
$res= mysql_query($sql) or die(mysql_error());
$login_match= mysql_result($res, 0, 'login_match');
if ( $login_match == 1 ) {
$result = mysql_query ("SELECT ip FROM users90
WHERE username = '$username'
");
$row= mysql_fetch_array($result);
$iphmm = $row[0];
echo $iphmm . " This is ip from mysql <br>";
$ip = gethostbyname($iphmm);
echo "<br> This is ip from gethost " . $ip;
If ($ip ==$_SERVER["REMOTE_ADDR"]){
echo "You entered the magical place";
}else {
echo "failed";
}
} else {
 echo "failed";
}
}
?>

Last edited by danielmichel; 12-27-2006 at 11:36 AM. Reason: Reverted back to original
Taz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 12-18-2006, 05:40 PM   #2 (permalink)
Administrator
Enthusiast
 
johnboulder's Avatar
 
Join Date: Mar 2003
Posts: 97
johnboulder is just really nicejohnboulder is just really nice
Send a message via MSN to johnboulder Send a message via Yahoo to johnboulder Send a message via Skype™ to johnboulder
Default Re: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

Brilliant note here taz.

I tend to stay away from IP or host locking, as with a lot of cases - the users' IP address is not even the same accross requests depending on their ISP.

You could also get multiple requests from the same IP being different users on the same network sharing infrastructure the ISP has.

However, a great post nontheless.

I've moved this post to tutorials, as it's more suited to this particular category.

Regards
__________________
Sean Johnstone

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Tutorials:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorial on creating navigation tabs using CSS

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorial on PHP custom user authentication
johnboulder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 12-18-2006, 08:32 PM   #3 (permalink)
Taz
Junior Member
Newb
 
Taz's Avatar
 
Join Date: Dec 2006
Posts: 10
Taz will become famous soon enough
Default Re: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

Quote:
Originally Posted by johnboulder View Post
Brilliant note here taz.

I tend to stay away from IP or host locking, as with a lot of cases - the users' IP address is not even the same accross requests depending on their ISP.

You could also get multiple requests from the same IP being different users on the same network sharing infrastructure the ISP has.

However, a great post nontheless.

I've moved this post to tutorials, as it's more suited to this particular category.

Regards
I would like to point out while the example code is in php there is nothing stoping this concept from being implemented in c++, perl, in anything!

Maybe you want to edit the code for your VNC.
Taz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 12-18-2006, 08:36 PM   #4 (permalink)
Taz
Junior Member
Newb
 
Taz's Avatar
 
Join Date: Dec 2006
Posts: 10
Taz will become famous soon enough
Default Re: PHP: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

also now the link that was posted on http://www.digg.com/programming/Dyna...uthentication/
http://www.ny-dev.com/forums/website...tion-1253.html
doesn't work since you moved it and it isn't symlinked
Taz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 12-19-2006, 02:42 PM   #5 (permalink)
Administrator
Enthusiast
 
johnboulder's Avatar
 
Join Date: Mar 2003
Posts: 97
johnboulder is just really nicejohnboulder is just really nice
Send a message via MSN to johnboulder Send a message via Yahoo to johnboulder Send a message via Skype™ to johnboulder
Default Re: PHP: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

I can move it back if you'd like

The only reason I moved it here was I felt it was more of a tutorial concept.

As an aside, it may be better to reference the post by the thread number, as that isn't changed by the topic being moved. (In this case, Dynamic IP Locking: A Poor Mans Multi-factor Authentication)

I humbly apologise if I've messed you about

Let me know
__________________
Sean Johnstone

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Tutorials:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorial on creating navigation tabs using CSS

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorial on PHP custom user authentication
johnboulder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 12-19-2006, 02:59 PM   #6 (permalink)
Administrator
Disciple
 
danielmichel's Avatar
 
Join Date: Feb 2003
Age: 29
Posts: 727
Images: 16
danielmichel is a glorious beacon of lightdanielmichel is a glorious beacon of lightdanielmichel is a glorious beacon of light
Send a message via AIM to danielmichel Send a message via MSN to danielmichel Send a message via Yahoo to danielmichel Send a message via Skype™ to danielmichel
Default Re: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

I'm not sure the link would even be the same if it were moved back.
Good call; no way you could have known about the whole digg thing.

He did however get 9 diggs in a very short time before the digg was retired.
I will re-submit the digg with this URL in a couple days if possible.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- A list of resources for 3D Developers

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- A list of resources for design in motion with Adobe After Effects

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Usefully resources for freelance web developers

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tips and discussion about search engine optimization

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorials submitted by ny-dev members
danielmichel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 12-19-2006, 07:16 PM   #7 (permalink)
Administrator
Disciple
 
danielmichel's Avatar
 
Join Date: Feb 2003
Age: 29
Posts: 727
Images: 16
danielmichel is a glorious beacon of lightdanielmichel is a glorious beacon of lightdanielmichel is a glorious beacon of light
Send a message via AIM to danielmichel Send a message via MSN to danielmichel Send a message via Yahoo to danielmichel Send a message via Skype™ to danielmichel
Default Re: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

The new digg - Dynamic IP Locking: A Poor Mans Multi-factor Authentication
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- A list of resources for 3D Developers

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- A list of resources for design in motion with Adobe After Effects

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Usefully resources for freelance web developers

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tips and discussion about search engine optimization

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorials submitted by ny-dev members
danielmichel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 12-21-2006, 08:13 AM   #8 (permalink)
Moderator
Aficionado
 
iughk's Avatar
 
Join Date: Feb 2006
Posts: 123
iughk is on a distinguished road
Default Re: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

Got the #1 Google spot for Dynamic IP Locking search.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
iughk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 12-21-2006, 09:01 AM   #9 (permalink)
Administrator
Disciple
 
danielmichel's Avatar
 
Join Date: Feb 2003
Age: 29
Posts: 727
Images: 16
danielmichel is a glorious beacon of lightdanielmichel is a glorious beacon of lightdanielmichel is a glorious beacon of light
Send a message via AIM to danielmichel Send a message via MSN to danielmichel Send a message via Yahoo to danielmichel Send a message via Skype™ to danielmichel
Default Re: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

If only you could combine or edit diggs as the digg author.

This one has 4 diggs - digg - Dynamic IP Locking: A Poor Mans Multi-factor Authentication
This one has 11 diggs - digg - Dynamic IP locking: A Poor Mans Multi-factor Authentication
(broken link)
and the one you linked to has 2 diggs.

I'm going to contact digg about it when i get a chance.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- A list of resources for 3D Developers

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- A list of resources for design in motion with Adobe After Effects

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Usefully resources for freelance web developers

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tips and discussion about search engine optimization

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorials submitted by ny-dev members
danielmichel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 01-02-2007, 10:37 PM   #10 (permalink)
SHP
Sexual Harassment Panda
Aficionado
 
SHP's Avatar
 
Join Date: Dec 2004
Posts: 139
Images: 2
SHP will become famous soon enough
Default Re: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

Another one on Hotscripts
Dynamic IP Locking
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- New York Web Development member gallery

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Community members show off your work

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Members compete for bragging rights or prizes
SHP is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Old 01-12-2007, 08:52 PM   #11 (permalink)
Moderator
Aficionado
 
Contention's Avatar
 
Join Date: Mar 2003
Age: 31
Posts: 147
Contention is on a distinguished road
Default Re: Dynamic IP Locking: A Poor Mans Multi-factor Authentication

This is curious
Detail: Dynamic IP Locking: A Poor Mans Multi-factor Authentication
__________________
Misc Tutorials:

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorial on Flash Interval Managers

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Simple Ajax tutorial for beginners

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Tutorial on creating CSS tabs

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Some things you should read before posting
Contention is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Google Bookmark this Post!Blink this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP: Custom user authentication johnboulder Tutorials 6 01-03-2007 07:18 PM
Need help on embedded video dynamic size Leo Website Programming 1 10-16-2006 07:25 AM
Dynamic web design. Jacer17 Website Programming 14 05-12-2006 05:45 PM
Poor PC danielmichel General Conversation 2 03-24-2006 08:00 PM


All times are GMT -4. The time now is 06:36 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13