Skip to main content
deleted 113 characters in body
Source Link
700 Software
  • 14k
  • 3
  • 55
  • 82

Update: see comments below.

Also, perhaps there is a vulnerability if you are using real_escape_string instead of mysql_real_escape_string? Not sure about this one regarding proper implementation.


Original answer, before knowing this was officially documented:

The use of function real_escape_string with substitution %s within an already quoted string '%s' looks highly suspect.

There could well be a vulnerability if

  • if real_escape_string not designed correctly,
  • or not used in accordance with its documentation. (mis-used, perhaps with extra quotes ' or something else)

I would highly recommend using a more standard method of solving SQLi in PHP. One that involves ? substitution is best. However there may be another sound encoding method available. Such methods usually add their own quotes internally, in which case adding quotes ' in your code would be unnecessary.

I did notice one other thing about that code. Where does PREFIX come from? If this is user-provided then you obviously have an SQLi vulnerability. On the other hand, if it is simply a hard-coded or well-sanitized value then you are OK with that one.

Update: see comments below.

Also, perhaps there is a vulnerability if you are using real_escape_string instead of mysql_real_escape_string? Not sure about this one.


Original answer, before knowing this was officially documented:

The use of function real_escape_string with substitution %s within an already quoted string '%s' looks highly suspect.

There could well be a vulnerability if

  • if real_escape_string not designed correctly,
  • or not used in accordance with its documentation. (mis-used, perhaps with extra quotes ' or something else)

I would highly recommend using a more standard method of solving SQLi in PHP. One that involves ? substitution is best. However there may be another sound encoding method available. Such methods usually add their own quotes internally, in which case adding quotes ' in your code would be unnecessary.

I did notice one other thing about that code. Where does PREFIX come from? If this is user-provided then you obviously have an SQLi vulnerability. On the other hand, if it is simply a hard-coded or well-sanitized value then you are OK with that one.

Update: see comments below regarding proper implementation.


Original answer, before knowing this was officially documented:

The use of function real_escape_string with substitution %s within an already quoted string '%s' looks highly suspect.

There could well be a vulnerability if

  • if real_escape_string not designed correctly,
  • or not used in accordance with its documentation. (mis-used, perhaps with extra quotes ' or something else)

I would highly recommend using a more standard method of solving SQLi in PHP. One that involves ? substitution is best. However there may be another sound encoding method available. Such methods usually add their own quotes internally, in which case adding quotes ' in your code would be unnecessary.

I did notice one other thing about that code. Where does PREFIX come from? If this is user-provided then you obviously have an SQLi vulnerability. On the other hand, if it is simply a hard-coded or well-sanitized value then you are OK with that one.

added 162 characters in body; added 156 characters in body; deleted 22 characters in body
Source Link
700 Software
  • 14k
  • 3
  • 55
  • 82

The use of functionUpdate: see comments below.

Also, perhaps there is a vulnerability if you are using real_escape_string with substitution %s within an already quoted stringinstead of '%s'mysql_real_escape_string looks highly suspect? Not sure about this one.

 

There could well be a vulnerability ifOriginal answer, before knowing this was officially documented:

  • if real_escape_string not designed correctly,
  • or not used in accordance with its documentation. (mis-used, perhaps with extra quotes ' or something else)

The use of function real_escape_string with substitution %s within an already quoted string '%s' looks highly suspect.

There could well be a vulnerability if

  • if real_escape_string not designed correctly,
  • or not used in accordance with its documentation. (mis-used, perhaps with extra quotes ' or something else)

I would highly recommend using a more standard method of solving SQLi in in PHP. One that involves ? substitution is best. However there may be be another sound encoding method available. Such methods usually add their their own quotes internally, in which case adding quotes ' in your code code would be unnecessary.

I did notice one other thing about that code. Where does PREFIX come from from? If this is user-provided then you obviously have an SQLi vulnerability vulnerability. On the other hand, if it is simply a hard-coded or well well-sanitized value then you are OK with that one.

The use of function real_escape_string with substitution %s within an already quoted string '%s' looks highly suspect.

There could well be a vulnerability if

  • if real_escape_string not designed correctly,
  • or not used in accordance with its documentation. (mis-used, perhaps with extra quotes ' or something else)

I would highly recommend using a more standard method of solving SQLi in PHP. One that involves ? substitution is best. However there may be another sound encoding method available. Such methods usually add their own quotes internally, in which case adding quotes ' in your code would be unnecessary.

I did notice one other thing about that code. Where does PREFIX come from? If this is user-provided then you obviously have an SQLi vulnerability. On the other hand, if it is simply a hard-coded or well-sanitized value then you are OK with that one.

Update: see comments below.

Also, perhaps there is a vulnerability if you are using real_escape_string instead of mysql_real_escape_string? Not sure about this one.

 

Original answer, before knowing this was officially documented:

The use of function real_escape_string with substitution %s within an already quoted string '%s' looks highly suspect.

There could well be a vulnerability if

  • if real_escape_string not designed correctly,
  • or not used in accordance with its documentation. (mis-used, perhaps with extra quotes ' or something else)

I would highly recommend using a more standard method of solving SQLi in PHP. One that involves ? substitution is best. However there may be another sound encoding method available. Such methods usually add their own quotes internally, in which case adding quotes ' in your code would be unnecessary.

I did notice one other thing about that code. Where does PREFIX come from? If this is user-provided then you obviously have an SQLi vulnerability. On the other hand, if it is simply a hard-coded or well-sanitized value then you are OK with that one.

Source Link
700 Software
  • 14k
  • 3
  • 55
  • 82

The use of function real_escape_string with substitution %s within an already quoted string '%s' looks highly suspect.

There could well be a vulnerability if

  • if real_escape_string not designed correctly,
  • or not used in accordance with its documentation. (mis-used, perhaps with extra quotes ' or something else)

I would highly recommend using a more standard method of solving SQLi in PHP. One that involves ? substitution is best. However there may be another sound encoding method available. Such methods usually add their own quotes internally, in which case adding quotes ' in your code would be unnecessary.

I did notice one other thing about that code. Where does PREFIX come from? If this is user-provided then you obviously have an SQLi vulnerability. On the other hand, if it is simply a hard-coded or well-sanitized value then you are OK with that one.