Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Verifying Logins  (Read 1193 times)
0 Members and 1 Guest are viewing this topic.
Offline Jacob_

Junior Member


Projects: 3



« Posted 2010-05-19 17:06:17 »

I'm trying to figure out how to prevent hacking/impersonation in Buildsim. There is a central user database, but servers are hosted by players. Currently, users login on the website and click a link to join a server, which creates a webstart file with the correct information filled in. The problem is that people can save the web start file locally and edit it--not good! I was orignally going to have the client send some kind of user-specific key to the game server--their password hash, or one generated by the website that is used only for multiplayer. But then I realized that a server admin could steal someone's key using wireshark and login as them anywhere they wanted.

I guess I need to make the key specific to each server somehow, but how? Using the server name or something as a salt would work, but eventually someone would crack it and leak the details of the hash on /b/. Any suggestions?
Online Riven
« League of Dukes »

JGO Overlord


Medals: 439
Projects: 4


Hand over your head.


« Reply #1 - Posted 2010-05-19 18:06:06 »

You can do a hash handshake. The password will not be transfered.

Google "MD5 handshake" but apply it using another hash function (like SHA2)


You end up with a structure like:
Client -> User Hosted Game Server -> Secure Central User Database

1. "Client" wants to login
2. "Client" sends username, sends it to "User Hosted Game Server"
3. "User Hosted Game Server" sends it to "Secure Central User Database"
4. "Secure Central User Database" generates salt, calculates [hash of (salt+client.password)] , but sends [salt] to "User Hosted Game Server"
5. "User Hosted Game Server" sends hash to "Client"
6. "Client" knows own password (obviously) and calculates [hash of (salt+client.password)], and sends it to "User Hosted Game Server"
7. "User Hosted Game Server" sends it to "Secure Central User Database"
8. "Secure Central User Database" compares remembered [hash of (salt+client.password)] with answer from "Client"
9. "Secure Central User Database" sends SUCCESS/FAILURE to "User Hosted Game Server"
10. "User Hosted Game Server" now knows whether "Client" is authenticated, disconnects from "Secure Central User Database"
11. "User Hosted Game Server" sends SUCCESS/FAILURE to "Client"
12. "User Hosted Game Server" and "Client" do their magic.


This is basically a hash handshake with a proxy in between. The proxy becomes the server once the handshake is finished. Note that "Client" never connects to "Secure Central User Database".


Note:
The above communication suggests that "Secure Central User Database" has the 'client.password' stored in plaintext. This is inherently unsafe, so (once it works) you can replace 'client.password' with 'hash of (hardcoded salt + client.password)' on both sides of the handshake. Keep in mind that it doesn't matter that clients know the password-salt used on the server. This renders MD5/SHA lookup tables useless.

Note 2:
The "Client" must guard against the "User Hosted Game Server" sending a hash of "" (empty string). That way the "Client" would hash (password+"") and send that to "User Hosted Game Server", which can then lookup the hash in a lookup table. A better salt-hash-function than hash(salt+password) would be hash(hash(salt), hash(password)) anyway.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Projects: Revenge of the Titans, Titan Attacks, Droid Assault, and Ultratron
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (133 views)
2013-05-18 03:29:12

alaslipknot (142 views)
2013-05-17 03:24:48

gouessej (171 views)
2013-05-16 06:53:38

gouessej (166 views)
2013-05-16 06:17:58

theagentd (175 views)
2013-05-15 21:01:13

theagentd (160 views)
2013-05-15 21:00:54

StreetDoggy (204 views)
2013-05-14 21:56:26

kutucuk (228 views)
2013-05-12 23:10:36

kutucuk (228 views)
2013-05-12 21:36:09

UnluckyDevil (231 views)
2013-05-12 11:09:57
Complex number cookbook
by Roquen
2013-04-24 18:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 22:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 22:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 22:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 23:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 22:17:38

Java Data structures
by Roquen
2013-03-29 19:21:12

Topic Request
by kutucuk
2013-03-23 03:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.084 seconds with 20 queries.