状態

状態

状態

私は大学で「クラウドセキュリティ」を教えており、現在仮想マシンの内部検査に関するプロジェクトを進めています。

私の練習の目的は、いくつかのプロセスの権限をrootに昇格させることです。これは、次のようにstruct credfromへのポインタを「借りる」ことです。init揮発性そしてlibvmi。デフォルトでは、いくつかのルートキットに似ていますが、ある仮想マシンから別の仮想マシンに移動します。保護されたメモリへの書き込みを繰り返し試みる一部のプロセスの権限を上げることで、このアプローチの効率性を実証することができました。そう:

#!/bin/bash
while true
do
    echo 1 >> /etc/test
    id
    sleep 2
done

結果は次のとおりです(権限が変更された場合)。

# last time permission is denied
./test.sh: line 3: /etc/test: Permission denied
uid=1000(tester) gid=1000(tester)groups=1000(tester),24(cdrom),
25(floppy),29(audio),30(dip),44(video),46(plugdev),108(netdev),
111(scanner),115(bluetooth)

# tada, magic

# now I'm root
uid=0(root) gid=0(root) groups=0(root)

質問

bashしたがって、上記の例では、一部のプロセスがルート権限を持っていることを証明できます。しかし、ビュープロセスを使用したり直接ps u進んだりしても何も変わらないようです/proc/$PIDUIDGID

出力ps -A u | grep 2368

今後:

# ...
tester    2368  0.0  0.9  23556  4552 pts/2    S+   22:24   0:00 -bash

後ろに:

# ...
tester    2368  0.0  0.9  23556  4552 pts/2    S+   22:24   0:00 -bash

ここでは何も変わりませんでした。

また、/proc/$PID/status変更されていません。

~# cat /proc/2368/status | grep Uid
Uid:    1000    1000    1000    1000
~# cat /proc/2368/status | grep Gid
Gid:    1000    1000    1000    1000

それでは説明できますか?なぜ彼らは変わらずそこにいて、どここの情報は、プロセスからインポートされていない場合、struct credプロセスが明らかに変更されたことに由来します。

ベストアンサー1

ジョブに構造 cred がありません。彼らは持っている二つ構造的信用:

 * A task has two security pointers.  task->real_cred points to the objective
 * context that defines that task's actual details.  The objective part of this
 * context is used whenever that task is acted upon.
 *
 * task->cred points to the subjective context that defines the details of how
 * that task is going to act upon another object.  This may be overridden
 * temporarily to point to another security context, but normally points to the
 * same context as task->real_cred.

/procどのようなことをお見せするのかを確認しましたが、おそらく推測することができます:-P。

(fs/proc/を参照し、https://elixir.bootlin.com。 procfs "ステータス"ファイルはfs/proc/base.cで定義されています。 )

おすすめ記事