DevTools
Js反混淆
加/解密
POST request
編/解碼
Hack The Box官網介紹
A massive playground for you to learn
and improve your pen-testing skills.
簡單來說,Hack The Box就是一個讓你挑戰極限滲透測試的地方。我自己在挑戰的時候, 也遇到許多挫折;不過也受益匪淺,透過尋找相關漏洞,也融會貫通舊有的Web知識。因此,我將這次的獲取HTB(Hack The Box)邀請碼挑戰過程紀錄下來,當作技術筆記。然而,想要登門挑戰,沒有三兩三,豈敢上梁山?因此HTB官網設置了第0關,想要登入,就必須先破解並獲取邀請碼註冊登入。
總共,五關卡。每破解一關,除了離取得邀請碼更近之外,也更進一步學習Web的基礎,著實看到HTB的用心良苦。
若要挑戰,請點擊此處:HTB獲取邀請碼網址
首先,先開啟開發者工具(Mac:command+option+i; Win:F12)。在Console會發現一個骷髏頭畫面。
覺得事有玄機,因此將Element, Sources, Network頁籤全點開過一次。發現在Sources -> www.hackthebox.eu -> js -> inviteapi.min.js 裡面發現一個很特別的JavaScript的檔案。
inviteapi.min.js程式內容:
發現被混淆了,看不是很懂裡面的內容,但勉強可以看出它是一個function。
是一個線上工具
用途:Beautify, unpack or deobfuscate JavaScript and HTML, make JSON/JSONP readable, etc.
使用方法,將程式碼複製貼上。再按下Beautify Code,即可獲得非混淆的程式碼。
我們將程式碼反混淆後,得到兩個JavaScript function。
第一個function似乎用來驗證邀請碼,第二個function用來產生邀請碼。兩個function與對應的網址以POST method傳遞資料。因為我們還沒有邀請碼,因此不用第一個function,而是用第二個function來產生驗證碼。
這邊有兩個方法可以產生邀請碼:
curl -X POST https://www.hackthebox.eu/api/invite/how/to/generate
這邊我們填上相對應得domain(https://www.hackthebox.eu)與directory(/api/invite/how/to/generate)
獲得資訊:
data: "Va beqre gb trarengr gur vaivgr pbqr, znxr n CBFG erdhrfg gb /ncv/vaivgr/trarengr"
enctype: "ROT13"
原來是一個加密文字,透過ROT13加密。知道這些資訊後,接著便要開始解密了!
隨手Google ROT13,發現了一個網站。
ROT13線上解密
ROT13 ("rotate by 13 places", sometimes hyphenated ROT-13) is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in the alphabet. ROT13 is a special case of the Caesar cipher which was developed in ancient Rome.
Ctrl+c, Ctrl+v,線上解密後得到另一個網址。
於是,我們繼續使用 curl,以 POST method 向https://www.hackthebox.eu/api/invite/generate/獲取資訊。
curl -X POST https://www.hackthebox.eu/api/invite/generate/
開始decode!
In computer science, Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation.
複製貼上、解碼、獲得邀請碼(碼一下XD)
這樣就可以登入囉!
st=>start: HTB invite網站
e=>end: Success
op=>operation: 開法者工具
op2=>operation: JavaScript反混淆檔
op3=>operation: 解密
op4=>operation: 發Request
op5=>operation: 解碼
st->op->op2->op3->op4->op5->e
祝大家 Happy Hacking!
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing