Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 31.08.2006, 08:55   #1
kembl
Архивный участник
 
Join Date: May 2005
Posts: 63
Default [SHARE] Prevent passwords bruteforcing

I know that some game passwords online checkers are exists now, so there a way to make this process slowly.

This is SQL Server side modification, already checked under SQL2005 EXPRESSS

1) you need to add table user_auth_log to lin2db

Code:
USE [lin2db]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[user_auth_log](
	[sid] [int] IDENTITY(1,1) NOT NULL,
	[account] [varchar](14) COLLATE Cyrillic_General_CI_AS NULL,
	[success] [tinyint] NOT NULL CONSTRAINT [DF_user_auth_log_success]  DEFAULT ((2)),
	[dt] [datetime] NOT NULL CONSTRAINT [DF_user_auth_log_dt]  DEFAULT (getdate())
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
than, set rights to your lineage2 server SQL account to INSERT and SELECT from this table.

2) You need to modify lin2db..ap_GPwd stored procedure:


Code:
set ANSI_NULLS OFF
set QUOTED_IDENTIFIER OFF
GO

ALTER PROCEDURE [dbo].[ap_GPwd]  @account varchar(14), @pwd binary(16) output
AS
--exec ap_GPwd_log @account

-- Created By darkangel
-- 20xx.xx.19
-- updated 20xx.xx.14 by KEMBL
-- set Account's auth logging
-- updated 20xx.xx.31 Logrus, Drone
-- added login counts per time check 

SET NOCOUNT ON

if (SELECT COUNT(*) FROM lin2db..user_auth_log WHERE account=@account AND DATEDIFF(mi, dt, GETDATE()) < 16) > 4 
	OR
	(SELECT COUNT(*) FROM lin2db..user_auth_log WHERE account=@account AND DATEDIFF(ss, dt, GETDATE()) < 3) > 0
	BEGIN				
		INSERT INTO user_auth_log (account,success) VALUES (@account, 0)				
	   SET NOCOUNT OFF
		SELECT @pwd = 0xC3371572F8F9BF71A8D31A1EB2436D6C		
	END
ELSE
	BEGIN
		INSERT INTO user_auth_log (account,success) VALUES (@account, 1)		
	   SET NOCOUNT OFF
		SELECT @pwd=password FROM user_auth with (nolock) WHERE account=@account
	END
thats all.

So, now rules are: 5 login tryes per 15 minutes and not less than 2 seconds between tryes.

One more bad things exists with this code

Change binary 16 string in value @pwd
Code:
	SELECT @pwd = 0xC3371572F8F9BF71A8D31A1EB2436D6
to some else which nobody knows, cause if some one finds password for this value, he gets access to any one account on your server after 5 mistakes. It's better to random generate there some unique every time, but in this way procedure will be more slowly.

P.S. If you have got hex fix (or other) to login two users with one char (for self clone, selling and dupe resources), please share it. Torune's patch is great, but ability for char cloning still exists.
kembl is offline  
 


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

Forum Jump


All times are GMT. The time now is 16:37.