We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29597 ☆ A M B ☆
    • 350 Posts
    I need some help, my biggest client told me they have a ​Potential BlindSQL Injection on www.somesite.com

    Below is part of the report they send me, I know the get C is the context and the page they link to is just a FR blog overview page: https://www.somesite.com/fr/news/product-blog/

    Can anybody help me fix this? Will pay for time!

    The email I got:

    I have yesterday received a warning from a security scan telling that our website has a BlindSQL injection vulnerability. Please find details about the finding in the attached PDF.I can unfortunately not reproduce the issue, therefore I hope you can tell what is happening. Don’t look too much on the SQL code that has been sent to the website, but at how the input is used:

    • What is GET parameter “c” and how is it used in ModX?
    • How is it passed to the database? à IF the vulnerability exists, then it has to be here
    I am not sure if it is really a BlindSQL injection, however we need to verify this because IF it is possible to pass SQL commands to the database, an attacker might easily drop tables for example.

    I can unfortunately not help you with debugging (don’t know ModX good enough), but I can help you verifying code in case you find something – let me know!

    In the PDF:

    URI
    https://www.somesite.com/fr/news/product-blog/?c=fr%27%20%2B%20(SELECT%200%20FROM%20(SELECT%20SLEEP(28))qsqli_2222)%20%2B%20%27&page=2

    www.somesite.com

    Result
    Mean response time: 565
    Standard deviation: 594
    Number of stddev from mean: 46.592854

    This vulnerability was identified using time-based inference that compared the average response time of a page to its response time with an injected payload. This vulnerability is confirmed based on timing rather than the content of the response.

    Payload
    %27%20%2B%20(SELECT%200%20FROM%20(SELECT%20SLEEP(28))qsqli_2222)%20%2B%20%27

    This question has been answered by ThaClown. See the first response.

    [ed. note: ThaClown last edited this post 10 years, 3 months ago.]
      MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
      DESIGNfromWITHIN, MPThemes and Any Screen Size
      Follow me on Twitter | Read my blog | My code on GitHub
      • 33991
      • 65 Posts
      As I see, "c" is your parameter to pass language or context key.


      So, you need to check your snippet, that handles pagination and receives this "c" parameter from $_GET.
        • 29597 ☆ A M B ☆
        • 350 Posts
        Strange this is just the default articles [[+paging]] snippet...

        In the template:

        [[+articles]]
        <ul class="paging_ul">
        [[+paging]]
        </ul>
        
          MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
          DESIGNfromWITHIN, MPThemes and Any Screen Size
          Follow me on Twitter | Read my blog | My code on GitHub
        • discuss.answer
          • 29597 ☆ A M B ☆
          • 350 Posts
          With help from Vasiliy we found the issue was with the Redirector plugin when the rare case of not found page and injection in url happens...

          We fixed the issue and I wil submit a issue for the plugin https://github.com/modxcms/Redirector.

          filter request in plugin
          $search = rawurldecode($_SERVER['REQUEST_URI']);

          replace to
          $search = rawurldecode($_SERVER['REQUEST_URI']);
          $search = preg_replace('#\(.*?\)+#', '', $search);
          [ed. note: ThaClown last edited this post 10 years, 3 months ago.]
            MODX Ambassador (NL) | Responsive web design specialist, developer & speaker
            DESIGNfromWITHIN, MPThemes and Any Screen Size
            Follow me on Twitter | Read my blog | My code on GitHub