ellcs
    • 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

      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
    • Engagement control
    • 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 Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control 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

    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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Such popular, much wow Category: Web Difficulty: Medium Author: 0x4d5a https://nx1765.your-storageshare.de/s/zcooKARjm5cWnso I heard you like web challenges with sourcecode provided. Lets find a simple 0-day in an old and vulnerable plugin. Take a look at the entry-point.sh script. You'll find helpful credentials in there. Challenge Files:such-popular-much-wow.zip ## Flag The flag is found inside the docker container under /var/www/flag.txt. In wordpress you can install plugins to get a shell to cat this flag. ## first inspection When downloading the file, we see that we have a wordpress application with a mysql backend: ``` . ├── docker-compose.yaml ├── mysql │   └── Dockerfile └── wordpress ├── 000-default.conf ├── Dockerfile ├── entry-point.sh ├── firefox-script.py └── flag.txt 3 directories, 7 files ``` Just enter the directory and use `docker compose up`. ![](https://hackmd.io/_uploads/SJwL6Oj3n.png) We can see, that one blog post is online and can comment that one. Lets start with wpscan ```bash _______________________________________________________________ __ _______ _____ \ \ / / __ \ / ____| \ \ /\ / /| |__) | (___ ___ __ _ _ __ ® \ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \ \ /\ / | | ____) | (__| (_| | | | | \/ \/ |_| |_____/ \___|\__,_|_| |_| WordPress Security Scanner by the WPScan Team Version 3.8.24 Sponsored by Automattic - https://automattic.com/ @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart _______________________________________________________________ Scan Aborted: The url supplied 'https://localhost:1024/' seems to be down (SSL connect error) w1ntermute@w1ntermute:~/git/RedNix$ wpscan --api-token GU4aChAb2RaEj6hgZjL92GkH4JQi6a3iuasiES0QEzc --url http://localhost:1024 _______________________________________________________________ __ _______ _____ \ \ / / __ \ / ____| \ \ /\ / /| |__) | (___ ___ __ _ _ __ ® \ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \ \ /\ / | | ____) | (__| (_| | | | | \/ \/ |_| |_____/ \___|\__,_|_| |_| WordPress Security Scanner by the WPScan Team Version 3.8.24 Sponsored by Automattic - https://automattic.com/ @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart _______________________________________________________________ [+] URL: http://localhost:1024/ [::1] [+] Started: Thu Aug 17 11:57:56 2023 Interesting Finding(s): [+] Headers | Interesting Entries: | - Server: Apache/2.4.57 (Debian) | - X-Powered-By: PHP/8.1.22 | Found By: Headers (Passive Detection) | Confidence: 100% [+] XML-RPC seems to be enabled: http://localhost:1024/xmlrpc.php | Found By: Direct Access (Aggressive Detection) | Confidence: 100% | References: | - http://codex.wordpress.org/XML-RPC_Pingback_API | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_ghost_scanner/ | - https://www.rapid7.com/db/modules/auxiliary/dos/http/wordpress_xmlrpc_dos/ | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_xmlrpc_login/ | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_pingback_access/ [+] WordPress readme found: http://localhost:1024/readme.html | Found By: Direct Access (Aggressive Detection) | Confidence: 100% [+] This site seems to be a multisite | Found By: Direct Access (Aggressive Detection) | Confidence: 100% | Reference: http://codex.wordpress.org/Glossary#Multisite [+] The external WP-Cron seems to be enabled: http://localhost:1024/wp-cron.php | Found By: Direct Access (Aggressive Detection) | Confidence: 60% | References: | - https://www.iplocation.net/defend-wordpress-from-ddos | - https://github.com/wpscanteam/wpscan/issues/1299 [+] WordPress version 6.3 identified (Latest, released on 2023-08-08). | Found By: Rss Generator (Passive Detection) | - http://localhost:1024/?feed=rss2, <generator>https://wordpress.org/?v=6.3</generator> | - http://localhost:1024/?feed=comments-rss2, <generator>https://wordpress.org/?v=6.3</generator> [+] WordPress theme in use: twentytwentytwo | Location: http://localhost:1024/wp-content/themes/twentytwentytwo/ | Last Updated: 2023-03-29T00:00:00.000Z | Readme: http://localhost:1024/wp-content/themes/twentytwentytwo/readme.txt | [!] The version is out of date, the latest version is 1.4 | Style URL: http://localhost:1024/wp-content/themes/twentytwentytwo/style.css?ver=1.1 | Style Name: Twenty Twenty-Two | Style URI: https://wordpress.org/themes/twentytwentytwo/ | Description: Built on a solidly designed foundation, Twenty Twenty-Two embraces the idea that everyone deserves a... | Author: the WordPress team | Author URI: https://wordpress.org/ | | Found By: Css Style In Homepage (Passive Detection) | | Version: 1.1 (80% confidence) | Found By: Style (Passive Detection) | - http://localhost:1024/wp-content/themes/twentytwentytwo/style.css?ver=1.1, Match: 'Version: 1.1' [+] Enumerating All Plugins (via Passive Methods) [+] Checking Plugin Versions (via Passive and Aggressive Methods) [i] Plugin(s) Identified: [+] wordpress-popular-posts | Location: http://localhost:1024/wp-content/plugins/wordpress-popular-posts/ | Last Updated: 2023-07-24T22:33:00.000Z | [!] The version is out of date, the latest version is 6.2.1 | | Found By: Urls In Homepage (Passive Detection) | | [!] 5 vulnerabilities identified: | | [!] Title: WordPress Popular Posts < 5.3.3 - Authenticated Code Injection | Fixed in: 5.3.3 | References: | - https://wpscan.com/vulnerability/bd4f157c-a3d7-4535-a587-0102ba4e3009 | - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-42362 | - https://www.exploit-db.com/exploits/50129/ | - https://plugins.trac.wordpress.org/changeset/2542638 | - https://blog.nintechnet.com/improper-input-validation-fixed-in-wordpress-popular-posts-plugin/ | | [!] Title: WordPress Popular Posts < 5.3.3 - Authenticated Stored Cross-Site Scripting (XSS) | Fixed in: 5.3.3 | References: | - https://wpscan.com/vulnerability/86cc93c1-daf5-43e7-8afb-66362d784ce9 | - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-20746 | - https://plugins.trac.wordpress.org/changeset/2542638 | - https://jvn.jp/en/jp/JVN63066062/ | | [!] Title: WordPress Popular Posts < 5.3.4 - Admin+ Stored Cross-Site Scripting | Fixed in: 5.3.4 | References: | - https://wpscan.com/vulnerability/f1569584-e829-4d09-9535-bd5b11331339 | - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-36872 | | [!] Title: WordPress Popular Posts < 6.0.0 - Reflected Cross-Site Scripting | Fixed in: 6.0.0 | Reference: https://wpscan.com/vulnerability/a1113cf4-29ab-4dbd-841d-4e00f24b0b01 | | [!] Title: WordPress Popular Posts < 6.1.0 - Unauthenticated Views Manipulation | Fixed in: 6.1.0 | References: | - https://wpscan.com/vulnerability/9e497a16-67dc-47f7-b509-63bf11888f56 | - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-43468 | - https://jvn.jp/en/jp/JVN13927745/ | | Version: 4.2.2 (100% confidence) | Found By: Query Parameter (Passive Detection) | - http://localhost:1024/wp-content/plugins/wordpress-popular-posts/public/css/wpp.css?ver=4.2.2 | - http://localhost:1024/wp-content/plugins/wordpress-popular-posts/public/js/wpp-4.2.0.min.js?ver=4.2.2 | Confirmed By: Readme - Stable Tag (Aggressive Detection) | - http://localhost:1024/wp-content/plugins/wordpress-popular-posts/readme.txt [+] Enumerating Config Backups (via Passive and Aggressive Methods) Checking Config Backups - Time: 00:00:00 <=============================================================================================================================================================> (137 / 137) 100.00% Time: 00:00:00 [i] Config Backup(s) Identified: [!] http://localhost:1024/wp-config.php | Found By: Direct Access (Aggressive Detection) [+] WPScan DB API OK | Plan: free | Requests Done (during the scan): 3 | Requests Remaining: 22 [+] Finished: Thu Aug 17 11:58:02 2023 [+] Requests Done: 177 [+] Cached Requests: 5 [+] Data Sent: 36.91 KB [+] Data Received: 226.557 KB [+] Memory used: 248.578 MB [+] Elapsed time: 00:00:06 ``` We have some vulnerabilities. This script is the admin, that reviews posted comments and accepts every of them. ```python # # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" # # PLEASE DO NOT EDIT IT DIRECTLY. # FROM php:8.1-apache RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli RUN apt-get update && apt-get upgrade -y RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php.ini && \ sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /usr/local/etc/php.ini && \ sed -i 's/Listen 80/Listen 1024/' /etc/apache2/ports.conf && \ a2enmod rewrite && a2enmod headers RUN apt-get update && apt-get install default-mysql-client firefox-esr python3 python3-pip wget tar -y RUN pip3 install selenium requests --break-system-packages WORKDIR /tmp RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz RUN tar -xvzf geckodriver-v0.33.0-linux64.tar.gz && rm geckodriver-v0.33.0-linux64.tar.gz && chmod +x geckodriver && cp geckodriver /usr/local/bin/ COPY 000-default.conf /etc/apache2/sites-enabled/000-default.conf COPY entry-point.sh /usr/bin/entry-point.sh RUN chmod 777 /usr/bin/entry-point.sh COPY firefox-script.py /usr/bin/firefox-script.py RUN chmod 777 /usr/bin/firefox-script.py RUn mkdir -p /var/www/.cache /var/www/.mozilla && chmod 777 /var/www/.cache /var/www/.mozilla USER www-data WORKDIR /var/www/html COPY flag.txt /var/www/flag.txt RUN curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > /var/www/html/wp-cli.phar RUN ls -al ENTRYPOINT [ "/usr/bin/entry-point.sh" ] ``` As we can see, the admin is opening every comment inside a browser. So possibly XSS inside the thumbnail or comment. In the entry-point.sh file we have credentials hardcoded. ```bash=25 php wp-cli.phar --allow-root user create bob-the-author bob@cscg.live --role=author --user_pass=s3cur3PW ``` So we can use these to exploit the mentioned vulns. ![](https://hackmd.io/_uploads/Hk7r3Aihn.png)

    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