Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8298781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:54:33+00:00 2026-06-08T15:54:33+00:00

Strange problem appeared today on our server. We’ve got DDOS from % and _

  • 0

Strange problem appeared today on our server.
We’ve got DDOS from % and _ signs in mysql query which were successfully passed through GET request. For example

domain.com/search/%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25v%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25%25a

it appears to be cakephp doesn’t filter them? in official mysql guide they write about this problem a lot. that’s how they demonstrate to solve this:

addcslashes(mysql_real_escape_string(“%something_”), “%_”); 

in cakephp framework there’s function escape() which used everywhere in models. and look what it contains:

/** 
 * Returns a quoted and escaped string of $data for use in an SQL statement.
 *
 * @param string $data String to be prepared for use in an SQL statement
 * @param string $column The column into which this data will be inserted
 * @param boolean $safe Whether or not numeric data should be handled automagically if no column data is provided
 * @return string Quoted and escaped data
 */ 
    function value($data, $column = null, $safe = false) {
        $parent = parent::value($data, $column, $safe);

        if ($parent != null) {
            return $parent;
        }   
        if ($data === null || (is_array($data) && empty($data))) {
            return 'NULL';
        }   
        if ($data === '' && $column !== 'integer' && $column !== 'float' && $column !== 'boolean') {
            return "''";
        }   
        if (empty($column)) {
            $column = $this->introspectType($data);
        }   

        switch ($column) {
            case 'boolean':
                return $this->boolean((bool)$data);
            break;
            case 'integer' :
            case 'float' :
            case null :
                if ($data === '') {
                    return 'NULL';
                }   
                if (is_float($data)) {                                                                                                               
                    return str_replace(',', '.', strval($data));
                }
                if ((is_int($data) || is_float($data) || $data === '0') || (
                    is_numeric($data) && strpos($data, ',') === false &&
                    $data[0] != '0' && strpos($data, 'e') === false)) {
                        return $data;
                    }
            default:
                $data = "'" . mysqli_real_escape_string($this->connection, $data) . "'";
            break;
        }   

        return $data;
    }  

just a basic protection agains some variable types and stuff like this.. what about escaping mysql special characters?? about year ago i read how it’s possible to escape quote sign with help of percent sign in mysql query =) It was hype of blind injections back then, and that trick worked pretty much everywhere because everybody use mysqli_real_escape_string.

I must state a question here: How to escape variable in cakephp – REALLY SAFELY?

update: some folks in IRC states that REQUEST string must be escaped and not query it self. they probably right, then how can I escape % and _ chars in GET request string without using custom functions.. any sanitize method does it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:54:34+00:00Added an answer on June 8, 2026 at 3:54 pm

    This doesn’t mean Cake is susceptible to SQL injection, as it in the underbelly it uses prepared statements, it does mean you are using a LIKE search query in CakePHP and it’s letting the wildcard characters though.

    I don’t think this is ideal behaviour as I have found this out while developing too, I just have this line above finds that use LIKE now.

    $term = str_replace('%', ' ', $term); 
    

    You don’t need to take escaping in to your own hands, the framework handles that for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a strange problem. I've got a function dbo.ufn_GetDaysInYear which seems to give
I have a strange problem which seems to have recently appeared. I used to
Strange problem. My Query looks like SELECT DISTINCT ID, `etcetc`, `if/elses over muliple joined
Strange problem occurs on the production platform (64 bit win 2008 server). It is
I have a strange problem with sqlite which is driving me crazy. I have
A strange problem occurred yesterday on a production system which has been running fine
strange problem occurs with json_encode(). I have some text in mysql database in russian.
I have a strange problem that recently appeared. At first I was loading all
I have strange problem for which I can't think of a solution. I have
Strange problem here... UPDATE After adding a lot more server side debugging, I found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.