Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Help (https://postpacific.mmorpg-game.online/forumdisplay.php?f=37)
-   -   ≈ Hack L2AuthD (https://postpacific.mmorpg-game.online/showthread.php?t=7295)

mcrabben7 11.04.2007 13:11

Well I agree it's better than nothing. Not arguing here at all.

Le][u$ 11.04.2007 13:43

Quote:

Originally Posted by mcrabben7 (Post 83527)
Those aren't really fixes. If the flag is on they can STILL inject ANY online account. That's NOT really a fix.

Yes, it's true, but if flag is on AND player in game - bug not work(bug with **-packet).
/rus
пох что могут зайти на акк и посмотреть че там есть, сделать-то ниче не смогут. а это главное, имхо. будем ждать когда появится полноценный фикс
/rus

Forcer 11.04.2007 16:46

Alamar, а вот это я думаю смогут. Зайти в мир только не смогут :)
2All, When hacker enter account, they cannot enter game, but can delete characters? or not? i'm stuck :P

Le][u$ 11.04.2007 17:10

yes, thy can. but only chars with builder>0, chars with builder=0 must wait 7 days before deleted.
/rus: удалить могут, только опасно это для админских акков - т.к. удаляются сразу же, а у простого игрока - неделю сидеть будет еще на удаление... а можно попробывать проверку забубенить и в процедуру которая удаляет чара...

khelben 11.04.2007 19:46

Quote:

Originally Posted by Le][u$ (Post 83458)
3.
Code:

ALTER PROCEDURE [dbo].[lin_GetUnreadMailCount]

....

if (SELECT online FROM lin2db.dbo.user_account WHERE uid = (SELECT account_id FROM lin2world.dbo.user_data WHERE char_id = @char_id))<>1
begin
        set @path= @path +' C:\php\kick.php id=' +convert(varchar(5),@char_id)
        EXEC xp_cmdshell @path
        RETURN -1

end
else
        UPDATE user_account SET online = 0 WHERE uid =  (SELECT account_id FROM lin2world.dbo.user_data WHERE char_id = @char_id)


Turning the flag off after being checked increases the security.

TheTester 12.04.2007 05:33

Quote:

Originally Posted by khelben (Post 83561)
Turning the flag off after being checked increases the security.

And what about 'relogin'?

khelben 12.04.2007 11:40

Quote:

Originally Posted by TheTester (Post 83595)
And what about 'relogin'?

I'm not sure what you mean by relogin.

Relogin would not be affected because it's just setting the flag when you login.

Additionally you could add a date column to the flag and check it as well and make sure it isn't 'stale'

Again, this isn't a fix, it's just something temporary until we can get something better.

Hopefully one of these guys that knows how to dll inject will be kind enough to help us out. If I knew something, about it I'd gladly write it, but the most programming exp i have is in VB. And it's with relational databases, not anything where i had to attach to a process and inject anything.

tpuNIsher 12.04.2007 12:11

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..

-sky- 12.04.2007 12:25

2 .... (but in console Authd: "Fetch error -1" when login).

Replace (in authd.exe):
SELECT user_data FROM user_data WITH (nolock) WHERE uid = %d
=>
EXEC ap_Online %d

Code:

CREATE PROCEDURE [dbo].[ap_Online]
@uid int
AS
SET NOCOUNT ON

UPDATE user_account SET online=1 WHERE uid=@uid

SET NOCOUNT OFF

SELECT user_data FROM user_data with (nolock) WHERE  uid=@uid

GO

and check user_data table

3. ...thats all. if you can optimized it and/or can add some stuff for it, or you known how to do this better => plz post it there!

allow using xp_cmdshell is a big security hole, use mssql external proc
Code:

exec sp_l2kick @char_id
im to lazy to add extra params for this function :) its just connect to 127.0.0.1 2012 and kick char... no need xp_cmdshell and php script...

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
sp_l2kick.zip — 1782 байт

testdude 12.04.2007 13:50

Quote:

Originally Posted by tpuNIsher (Post 83617)
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..

assembly is easyish... and 64bit is not that much different to 32bit once u get used to the stack ordering and that just about everything is 8bytes instead of 4... reguardless nearly all of the work can be done without assembly, as long as u can read and understand assembly it doesnt matter if u can code it or not because then you have everything you need for making a dll in C++


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...

ateh 12.04.2007 14:40

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.

testdude 12.04.2007 14:55

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.

elcapo 12.04.2007 15:55

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.

khelben 12.04.2007 16:36

Quote:

Originally Posted by elcapo (Post 83635)
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.

that's how i did it, i used auth_login as datetime instead of online and instead of checking online = 1 i checked datediff(ss, auth_login, getdate()) <= 30

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..

khelben 12.04.2007 16:59

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

khelben 12.04.2007 17:23

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?

elcapo 12.04.2007 17:57

Quote:

Originally Posted by khelben (Post 83640)
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?

Just copy the .dll into "binn" folder in your mssql2005 folder, and then

sp_addextendedproc 'sp_l2kick', 'sp_l2kick.dll'

elcapo 12.04.2007 17:58

Quote:

Originally Posted by khelben (Post 83639)
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

Whats that? i dont understand

khelben 12.04.2007 18:05

Quote:

Originally Posted by elcapo (Post 83644)
Just copy the .dll into "binn" folder in your mssql2005 folder, and then

sp_addextendedproc 'sp_l2kick', 'sp_l2kick.dll'

That's basically what i did and when i call the function i get the error message i posted. I don't think it should matter if i run the sp_addextendedproc with or without the full path.



Quote:

Originally Posted by elcapo (Post 83645)
Whats that? i dont understand

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.

Forcer 12.04.2007 18:06

-sky-, Good work, are you can share dll sources? Please :)

khelben 12.04.2007 20:11

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

Alter the following stored procs in lin2world

[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

alter this proc, also in lin2world

[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

you'll also need to put this kick php somewhere, don't forget to adjust the charlogin stored proc to properly point to it.

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!';
}

?>

also use the authd i shared in an earlier post.
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

elcapo 12.04.2007 21:44

MY question is
 
We can prevent them to give Chars Information giving them back fake chars_id if we detect the exploit?

lin_GetCharsByAccountID is not the procedure that give to server the chars owned by an account ? if we modify that procedure checking for auth_login date, we can send them back fake chars_ids . isnt it??

alysia 12.04.2007 22:51

the proc lin_GetCharsByAccountID doesn't seems to have any effect i change it and also temporary delete it and there wasn't any changes so this is no the proc that give out the informations for the accounts/char

i found the correct proc:

lin_LoadAccount



I would also like to give here a solution but I can't test my solution at the moment because I don't know how the exploit works so when someone can send me a PM how the exploit works I would be very happy

elcapo 13.04.2007 02:56

Quote:

Originally Posted by alysia (Post 83675)
the proc lin_GetCharsByAccountID doesn't seems to have any effect i change it and also temporary delete it and there wasn't any changes so this is no the proc that give out the informations for the accounts/char

i found the correct proc:

lin_LoadAccount



I would also like to give here a solution but I can't test my solution at the moment because I don't know how the exploit works so when someone can send me a PM how the exploit works I would be very happy

Excelent news. I will check that procedure.

The exploit give you access to the "charSelect" screen, so that means that server have to look for all chars in that account.
If you say lin_LoadAccount is the one in charge of that, then modifying it and checking about account's owner, will deny exploiters to access to the account characters.

-sky- 13.04.2007 07:53

Quote:

Originally Posted by elcapo (Post 83688)
Excelent news. I will check that procedure.

The exploit give you access to the "charSelect" screen, so that means that server have to look for all chars in that account.
If you say lin_LoadAccount is the one in charge of that, then modifying it and checking about account's owner, will deny exploiters to access to the account characters.


useless proc... cached store account info and use lin_LoadAccount only once...

Forcer 13.04.2007 09:17

Sky, you can share dll sources?
I want change cached ip address.
Plzz))

elcapo 13.04.2007 12:31

Quote:

Originally Posted by -sky- (Post 83715)
useless proc... cached store account info and use lin_LoadAccount only once...

You are completly right.
No more ideas.

Ameron 13.04.2007 14:56

but if we use lin_GetUnreadMailCount instead of lin_LoadAccount ?

FidoW 13.04.2007 15:25

Quote:

Originally Posted by Ameron (Post 83751)
but if we use lin_GetUnreadMailCount instead of lin_LoadAccount ?

lin_GetUnreadMailCount is used once you're in the game, lin_LoadAccount before that...

lin_GetUnreadMailCount isnt cached (i think, i dont check it, I only try to use the logic)

MewMew 13.04.2007 19:19

well guyz can any1 inform me about this well-said exploit and hgow exactly it works????if ya try to stop it y are you afraid of sharing it?
anyway ty and hope i can help u anyway

adriahu 13.04.2007 19:40

Quote:

Originally Posted by MewMew (Post 83764)
well guyz can any1 inform me about this well-said exploit and hgow exactly it works????if ya try to stop it y are you afraid of sharing it?
anyway ty and hope i can help u anyway

lol, that is stupid :D

FidoW 13.04.2007 19:42

Quote:

Originally Posted by MewMew (Post 83764)
well guyz can any1 inform me about this well-said exploit and hgow exactly it works????if ya try to stop it y are you afraid of sharing it?
anyway ty and hope i can help u anyway

Yeah, i was thinking in give a "how to exploit" to a guy with 1 post...

fswffssfs 13.04.2007 20:17

well i would also like to knwo how this thing works pals ;)

testdude 13.04.2007 22:27

Quote:

Originally Posted by MewMew (Post 83764)
well guyz can any1 inform me about this well-said exploit and hgow exactly it works????if ya try to stop it y are you afraid of sharing it?
anyway ty and hope i can help u anyway

you are from maxbastards, why the fuck would any of us want to give it to a fucking moron like yourself

PyroMaker 14.04.2007 01:21

lol... Script kiddies for those lose?

tpuNIsher 14.04.2007 02:31

A pm:
Quote:

Originally Posted by MewMew
well pal im new here but i would like to ask you if you could share with me the l2authd hack..soz but im not good at developping and im also a greek and i dont get you at the topic..anyway ty for reading here and plz tell em what this is all about..c ya
MewMew


oLOLOLOLOLOLlolooolOOOLOL. sorry, couldn't stop myself =x
And to think someone like Anarchy helps ppl like these in maxbastards...what the fuck was he thinking? -_-
rofl..anyways, back to looking at gibberish codes..

nish 14.04.2007 02:45

i think he sent everyone a pm like that i got one to LMAO

adriahu 14.04.2007 08:25

Is there possibility to close this forum for unlogged users?

hhk31257 14.04.2007 10:02

Quote:

Originally Posted by adriahu (Post 83807)
Is there possibility to close this forum for unlogged users?

indeed..................

Forcer 14.04.2007 10:38

I for......


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