SQL Injection - What to do

Discussion in 'MySQL' started by Adrianwart, Nov 19, 2008.

  1. #1
    Adsense begin serving irrelevant ads to my blog.
    Adsense support told me that those are caused by keywords planted to my blog.

    So I re-install my wordpress. But irrelevant as keep coming.

    So I guess someone already inject keywords to my SQL database.

    Is that possible ?

    If it is, then how can I remove those planted keywords ?
     
    Adrianwart, Nov 19, 2008 IP
  2. catapop

    catapop Peon

    Messages:
    79
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    well see what are the common keywords that are shown on your site
     
    catapop, Nov 19, 2008 IP
  3. Adrianwart

    Adrianwart Guest

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    My blog is about laptop and cellphone.

    but all ads shown on my blog are health related ads like cod liver oil, losing fat etc.
     
    Adrianwart, Nov 19, 2008 IP
  4. tamilsoft

    tamilsoft Banned

    Messages:
    1,155
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    0
    #4
    check your page source for injected keywords if any..
     
    tamilsoft, Nov 20, 2008 IP
  5. happpy

    happpy Well-Known Member

    Messages:
    926
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    120
    #5
    yeah check the html code. it would help if you posted the url, so experienced members could help you on that.
     
    happpy, Nov 20, 2008 IP
  6. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #6
    chisara, Nov 20, 2008 IP
  7. maestria

    maestria Well-Known Member

    Messages:
    705
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #7
    You may also track the ip address from which the posting is done, so that you may block those ip address with irrelevent posts.
     
    maestria, Nov 29, 2008 IP
  8. nogenius

    nogenius Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #8
    Keep your wordpress updated to the latest version always. Check the theme you are using, that could be the culprit.
     
    nogenius, Nov 29, 2008 IP
  9. pondlife

    pondlife Peon

    Messages:
    898
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Depends on what code your site is written in... protecting your input variables in PHP with mysql_real_escape_string() function is a good start :)
     
    pondlife, Nov 30, 2008 IP
  10. chisara

    chisara Peon

    Messages:
    141
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Or you might look into parameter binding, most DB libraries support something like this.
    With parameter binding you never pass your unsafe variable directly into an query, they are supplied using the parameter binding facilities.
    Any variable input in your query will be marked with an "(questionmark).
    Then you bind a programming variable to that question mark (properly escaping behind the scenes your data for your output domain e.q. Mysql or Postgresql )
    Execute your query.
    It looks more complex but in the end it creates code that is more attack resistant.
     
    chisara, Nov 30, 2008 IP
  11. TomSh

    TomSh Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    If its your server you might want to install dotdefender to protect your website from sql injection attacks and many more of them. I discover this by finding out I was injected with the asprox silent defacement attack that actually changed my database data and not the front end of the site.
     
    TomSh, Dec 29, 2008 IP
  12. olddocks

    olddocks Notable Member

    Messages:
    3,275
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    215
    #12
    use mysql_real_escape_string() to filter the GET and POST. Further ask your host to install mod-security.
     
    olddocks, Dec 29, 2008 IP
  13. sampathsl

    sampathsl Guest

    Messages:
    861
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #13
    I don't think the cause for your problem is a SQL injection attack. I mean its very hard to inject keywords through a wordpress blog using SQL injection. However please recheck is there any door open for an SQL injection, for example your SQL queries.
     
    sampathsl, Dec 29, 2008 IP