![]() |
|
|
|
|
#1 |
|
Архивный участник
Join Date: Apr 2006
Posts: 461
|
A nice way to fix this 90% is to implement an array in memory where you store account names and account IDs. When someone tries to login, check that the ID and Name are both correct. If they are not, log it as an exploit and kick the player.
Of course, this requires a coder and is probably beyond simple SQL, however, it might be possible to add a check for this into the stored procedures for logging in. Only thing missing from this fix is some sort of unique session key that can validate that the user has a valid session with authd, and isn't simply trying to exploit an account. |
|
|
|
|
#2 |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
what about setting a flag at login when checking for the other flags. (ap_Gstat)
then when loading the character, check for the flag. Proc has to be one that fires even when exploiter loads account. Maybe (lin_CharLogin)? if flag not present... kick. at end of proc, clear the flag. Just thinking out loud here... |
|
|
|
|
#3 |
|
Архивный участник
Join Date: Feb 2006
Posts: 15
|
made same way as said Le][u$. Just edit char_login and char_logout+added new field+script in l2auth.
php was stupid, so solution is to use wget --spider to send kick packet |
|
|
|
|
#4 |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
does char_logout fire on kick?
|
|
|
|
|
#5 | |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
Quote:
All the other posts have been vague references or theory. Instead of tearing someone's idea down, why not just offer your solution as an alternative and site reasons why your way is better. I mean, if I'm going to go out of my way to share something with you and you just tear it down and say it's stupid, why would I share anything again? You'll still need to launch wget much in the same way you'd launch the php compiler, and you'll still need the php with the kick code in it... Thanks Le][u$ for contributing. Reirus, thanks for the alternative. |
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: Apr 2006
Posts: 461
|
Those aren't really fixes. If the flag is on they can STILL inject ANY online account. That's NOT really a fix.
|
|
|
|
|
#7 | |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
Quote:
But right now we're hemorrhaging, we're just trying to stop the bleeding. Not everyone can write code to attach to a process and inject itself. I wouldn't know where to start with that, but I've always shared everything I've made, it might not be much and it might not be great, but it's what I have. If I could I'd rewrite the entire AuthD and add features that I feel should have been there from the start. But I'm not an experienced C programmer. I can hold my own in VB, which from what I hear is very similar to C#. But I'm digressing. Anyway, true, these aren't fixes, but it's better than nothing atm. =/ |
|
|
|
|
|
#8 | |
|
Архивный участник
Join Date: Aug 2006
Posts: 57
|
Quote:
/rus пох что могут зайти на акк и посмотреть че там есть, сделать-то ниче не смогут. а это главное, имхо. будем ждать когда появится полноценный фикс /rus |
|
|
|
|
|
#9 |
|
Архивный участник
Join Date: Mar 2006
Posts: 685
|
Correct and agreed, that isn't a fix. That is only a way around that works half as good.
There is a dll being made, however, it is up to the creator if it will be shared. As much as i would like to see it be shared, if the creator decides for it to be close quarter and among "sec-soc" community only, so it will be. Don't ask what is sec-soc. Anyways, for all those that have helped me, i'll be sure to repay the debt, thanks. I don't have anything useful for this topic anymore. -eof- |
|
|
|
|
#10 |
|
Архивный участник
Join Date: Apr 2006
Posts: 461
|
Well I agree it's better than nothing. Not arguing here at all.
|
|
|
|
|
#11 |
|
Архивный участник
Join Date: Apr 2006
Posts: 554
|
Alamar, а вот это я думаю смогут. Зайти в мир только не смогут
![]() 2All, When hacker enter account, they cannot enter game, but can delete characters? or not? i'm stuck :P |
|
|
|
|
#12 |
|
Архивный участник
Join Date: Aug 2006
Posts: 57
|
yes, thy can. but only chars with builder>0, chars with builder=0 must wait 7 days before deleted.
/rus: удалить могут, только опасно это для админских акков - т.к. удаляются сразу же, а у простого игрока - неделю сидеть будет еще на удаление... а можно попробывать проверку забубенить и в процедуру которая удаляет чара... |
|
|
|
|
#13 |
|
Архивный участник
Join Date: Mar 2006
Posts: 685
|
injecting dlls is easy as pie but coding in assembly isnt. 64 bit = even tougher . for me atleast.. anyways.. it will be fixed eventually. just dont pass the exploit around..to everyone that asks for how to do it..
|
|
|
|
|
#14 | |
|
Архивный участник
Join Date: Nov 2005
Posts: 504
|
Quote:
and as for the sql version of this fix.. there is no 100% secure way to make it work, the online thing is a cool concept but its all dependant on if it does write online = 0 when you log out, otherwise mr sploiter will still be able to access the acc... also you can still harrass gms/players with this exploit by kicking them off their acc, even though you cant login people will still be stupid enough to go and kick people off, send them ss' of their char select and say like "omg i hacked you, give me this or i will steal everything", and idiots will fall for it... imo best way to deal with this is to stop the injecting of the malformed packet... |
|
|
|
|
|
#15 |
|
Архивный участник
Join Date: Apr 2006
Posts: 118
|
Set login=0 when any char of logged account enters the world, plus set job to set login=0 every xx minutes for all accounts. This way Restart function of client won't work... but well, can't have everything.
|
|
|
|
|
#16 |
|
Архивный участник
Join Date: Nov 2005
Posts: 504
|
thats retarded, how many people are gonna wanna play a server that u have to completely relog every time u wanna change chars? considering theres like 4 servers now that have actual fixes that dont suck me thinks ideas like this will make ur players go elsewhere.
|
|
|
|
|
#17 |
|
Архивный участник
Join Date: Mar 2005
Posts: 107
|
you could use a "date" field instead of a integer.
update that field with NOW() when loggin correctly. (i dont remember the stored procedure that excecute when login). check for time difference at the time to take characters. if (field.time > 5 seconds) then, return char_id = -1 otherwise, give it the correct char_ids This way, u dont want to bother for updating to 0. Time is always running. What u think? I would to the change in this procedure: lin_GetCharByAccountId Why to give char_ids to someone who we dont know if is the owner? check first for that. Check too, at the time to create a new char. |
|
|
|
|
#18 | |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
Quote:
also on char logout you can set the auth login flag again, that would allow another 30 seconds for them to choose a character, no restart required. I'm going to package what i did here as soon as i can to make it easier on peeps, unless someone wants to share the dll fix.. |
|
|
|
|
|
#19 |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
Here's AuthD that calls ap_Online
you must have the following set in your config.txt: UserData=True http://www.2shared.com/file/1836692/...5/L2AuthD.html http://rapidshare.com/files/25634619/L2AuthD.rar.html |
|
|
|
|
#20 |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
can someone help me out with the sp_l2kick.dll?
I've never loaded Extended Proceedures into SQL before. I tried the following: sp_addextendedproc 'sp_l2kick', 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sp_l2kick.dll' but when i try to run the command it pukes with this message: Msg 17750, Level 16, State 0, Procedure sp_l2kick, Line 1 Could not load the DLL c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sp_l2kick.dll, or one of the DLLs it references. Reason: 193(%1 is not a valid Win32 application.). Will this work in SQL Server 2K5? |
|
|
|
|
#21 | |
|
Архивный участник
Join Date: Mar 2005
Posts: 107
|
Quote:
sp_addextendedproc 'sp_l2kick', 'sp_l2kick.dll' |
|
|
|
|
|
#22 | |
|
Архивный участник
Join Date: Mar 2005
Posts: 107
|
Quote:
|
|
|
|
|
|
#23 | |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
Quote:
It's just a modded AuthD that calls the function from page 9 instead of the original SQL. You still need to actually create the function in the database. |
|
|
|
|
|
#24 |
|
Архивный участник
Join Date: Apr 2006
Posts: 554
|
-sky-, Good work, are you can share dll sources? Please
|
|
|
|
|
#25 |
|
Архивный участник
Join Date: Mar 2006
Posts: 104
|
Ok.
Here's what i did. First, modify your USER_ACCOUNT table in lin2db. Add a column 'auth_login' as datetime create the following stored proc in lin2db [lin2db].[dbo].[ap_Online] Code:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER PROCEDURE [dbo].[ap_Online] @uid int AS SET NOCOUNT ON UPDATE user_account SET auth_login=GETDATE() WHERE uid=@uid SET NOCOUNT OFF SELECT uid FROM user_account with (nolock) WHERE uid=@uid [lin2world].[dbo].[lin_CharLogin] Code:
ALTER PROCEDURE [dbo].[lin_CharLogin] ( @char_id INT, @path varchar(64) = 'C:\php\php.exe' ) AS SET NOCOUNT ON UPDATE user_data SET login = GETDATE() WHERE char_id = @char_id if (SELECT datediff(ss, isnull(auth_login, 0), getdate()) FROM lin2db.dbo.user_account WHERE uid = (SELECT account_id FROM lin2world.dbo.user_data WHERE char_id = @char_id)) > 30 begin --I couldn't get sky's sp_l2kick.dll to work, so i went this route set @path= @path +' -f C:\php\kick.php ' +convert(varchar(5),@char_id) EXEC xp_cmdshell @path; RETURN -1 end [lin2world].[dbo].[lin_CharLogout] Code:
ALTER PROCEDURE [dbo].[lin_CharLogout]
(
@char_id INT,
@usedTimeSec INT
)
AS
SET NOCOUNT ON
DECLARE @logoutDate DATETIME
SET @logoutDate = GETDATE()
UPDATE user_data SET Logout = @logoutDate, use_time = use_time + @usedTimeSec WHERE char_id = @char_id
UPDATE lin2db..user_account SET auth_login=GETDATE() WHERE uid=(SELECT account_id from user_data where char_id = @char_id)
SET NOCOUNT OFF
kick.php Code:
<?php
//----Convert string to unicode---- >
function tounicode($string){
$rs="";
for($i=0;$i<strlen($string);$i++)
$rs.=$string[$i].chr(0);
return($rs.chr(0).chr(0));}
//<<<
function KickCharacterPacket($char_id){
$buf=pack("cV",5,$char_id).tounicode("HACK Detect");
$cachedsocket=@fsockopen("127.0.0.1","2012",$errno,$errstr,1) or die($notconnected);
fwrite($cachedsocket,pack("s",(strlen($buf)+2)).$buf);
$len=unpack("v",fread($cachedsocket,2));$rid=unpack("c",fread($cachedsocket,1));
for($i=0;$i<(($len[1]-4)/4);$i++){$read=unpack("i",fread($cachedsocket,4));$rs.=$read[1];}
fclose($cachedsocket);return $rs;}
$a = KickCharacterPacket($argv[1]);
if(!$a){
echo 'some errors ocured!';
}else{
echo 'Successed!';
}
?>
that should about cover it. you must have the following set in your config.txt: UserData=True http://www.2shared.com/file/1836692/...5/L2AuthD.html http://rapidshare.com/files/25634619/L2AuthD.rar.html |
|
|
|
|