Linux/suExecをバイナリ直接書き換え の変更点
*suExecをバイナリ直接書き換え [#wd2a7f34]
#contents
**vimに付属のxxdを使って、バイナリファイルを編集できるようにする。 [#hc0842c3]
"バイナリ編集(xxd)モード(vim -b での起動、もしくは *.bin で発動します)
# vi ~/.vimrc
-------- 下記を追加 --------
augroup BinaryXXD
autocmd!
autocmd BufReadPre *.bin let &binary =1
autocmd BufReadPost * if &binary | silent %!xxd -g 1
autocmd BufReadPost * set ft=xxd | endif
autocmd BufWritePre * if &binary | %!xxd -r
autocmd BufWritePre * endif
autocmd BufWritePost * if &binary | silent %!xxd -g 1
autocmd BufWritePost * set nomod | endif
augroup END
**suexec書き換え [#ya2cd8e2]
# cd /usr/sbin
# cp suexec suexec.test
# chmod u+w suexec.test
# vi -b suexec.test
00022d0: 29 0a 00 2d 56 00 61 70 61 63 68 65 00 2f 76 61 )..-V.apache./va
00022e0: 72 2f 77 77 77 00 20 2d 44 20 41 50 5f 44 4f 43 r/www. -D AP_DOC
↓
00022d0: 29 0a 00 2d 56 00 61 70 61 63 68 65 00 2f 68 6f )..-V.apache./ho
00022e0: 6d 65 00 00 00 00 20 2d 44 20 41 50 5f 44 4f 43 me.... -D AP_DOC
確認
# ./suexec.test -V
-D AP_DOC_ROOT="/home"
-D AP_GID_MIN=100
-D AP_HTTPD_USER="apache"
-D AP_LOG_EXEC="/var/log/httpd/suexec.log"
-D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
-D AP_UID_MIN=500
-D AP_USERDIR_SUFFIX="public_html"