Jump to content
  • 0

Possible SQL Injection via query_sql?


DarkIrata

Question


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  218
  • Reputation:   32
  • Joined:  05/29/12
  • Last Seen:  

Hello,

Is it possible to make a SQL Injection on a NPC where you cant put text?

(The text will checked in a sql table)

I tryed it few times without a success, but i think its still better if i ask before i use it ^^

Sry if there already a topic about it, nothing found so fast :/

Link to comment
Share on other sites

5 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  713
  • Reputation:   71
  • Joined:  11/08/11
  • Last Seen:  

---------------------------------------

*escape_sql(<value>)

Converts the value to a string and escapes special characters so that it is safe to use in query_sql().

Returns the escaped form of the given value.

Example 1:

set .@str$, "John's Laptop";

set .@esc_str$, escape_sql(.@name$); // Escaped string: John\'s Laptop

---------------------------------------

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  218
  • Reputation:   32
  • Joined:  05/29/12
  • Last Seen:  

Ahh thank you, good thats i asked ^-^

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  130
  • Reputation:   43
  • Joined:  12/11/11
  • Last Seen:  

It's next to impossible to inject if they do not get to insert text.

A possibility could exist depending on where it gathers it's information; like the name of character or a party name which could lead to an injection.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  218
  • Reputation:   32
  • Joined:  05/29/12
  • Last Seen:  

The problem is, i need to make a input. I know thats without thats, it would be impossible... (i can a little bit php)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  106
  • Reputation:   29
  • Joined:  11/08/11
  • Last Seen:  

The problem is, i need to make a input. I know thats without thats, it would be impossible... (i can a little bit php)

There is no problem if you pass the input through escape_sql, it's completely safe then.

input .@input$;
query_sql("SELECT `char_id` FROM `login` WHERE `name` =  '"+escape_sql(.@input$)+"' LIMIT 1", .@charid);

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...