Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: SQL injection

  1. #1

    Default SQL injection


    im into web develpment jud and also web destruction sad(for EVIL purposes).. ahhaha.....
    gusto unta ko mkahibaw sa mga pasikot-sikot aning SQL injection para ma prevent ni namo sa among project na himuun which is a Library system sa UC.. web based jud ni amo himuun na project para easy access.... long term goal namo ani nga project kay naa nay interconnection ang mga library of the different campuses of UC... peru before ana.. storya sa ta ug SQL injection..

    nag create ko ug akoang simple PHP-MYSQL web app with a user table (mga usernames[varchar] n passwords[varchar]) sa akoang database... mu enter ra ka ug username and password sa kani na web app.. ang code nku ani kay:

    $user = $_POST[user];
    $pass = $_POST[pass];

    $query = "SELECT * from user where username = '$user' ";

    then ako g input sa ako web form kay " 1' OR 1=1 -- "...
    so ang true query na i execute sa mysql kay: SELECT * from user where username = '1' OR 1=1....

    wala lagi mu gawas na something fishy?? ang web app ra gihapon ang gi display sa web browser.. mu work ba jud kaha ni ang SQL injection?? or saup lang jd akoang approach....?

    kung pwede sad ngau nya ko tips ninyu kung unsa ang mga preventive measures for SQL injections.. gamay ra man gud ako nahibaw-an... like encryption, filtering inputs, etc.. lamat daan...

  2. #2
    try 1' or 1 = '1

    btw, what's your php.ini settings? is magic_quotes_* on?

  3. #3
    Para nako maybe you should should parameterized statements?

  4. #4
    Because we are poor, shall we be vicious? vern's Avatar
    Join Date
    Feb 2003
    Gender
    Male
    Posts
    5,790
    eh, if you use something like PHP, just use one of the many HTML filters out there to prevent XSS attacks. You don't need to re-invent the wheel.

  5. #5
    html_entities and mysql_real_escape_string gamit kaayo nah nimo.

  6. #6
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    SQL injection is not just simply typing some strings on the textboxes, you should create another php/asp page that will target the server. In conjunction to the valid .php/.asp file who manage the process after "post"

    here's some example:

    <html>
    <form action="http://[SITE]/yourPage.asp" method="post">
    <input type="text" name="target_field_name" value="any_valid_field';[YOUR_SQL_CODE_HERE]">
    <input type="submit" name="submit" value="INJECT IT">
    </form>
    </html>
    SQL CODE such as:

    update INFO set Field1='your_injected_value’ where Field2='Field2';--

    or try to up your page… for practice. I can’t run my server. My company is blocking my webhost. I will make one as soon as I fix it.

  7. #7
    Quote Originally Posted by vern View Post
    eh, if you use something like PHP, just use one of the many HTML filters out there to prevent XSS attacks. You don't need to re-invent the wheel.
    Cross-site scripting (XSS) is not the same as SQL injection attacks. XSS vulnerability is basically a flaw in your script that allows the attacker to print unfiltered strings to the victim's browser. This allows cookie theft, among other things. SQL injection is a flaw that allows the attacker to craft malicious SQL queries.

  8. #8
    Quote Originally Posted by MarkCuering View Post
    SQL injection is not just simply typing some strings on the textboxes, you should create another php/asp page that will target the server. In conjunction to the valid .php/.asp file who manage the process after "post"
    It doesn't matter; it's just the same. My favorite tool is curl because it allows me to craft raw HTTP data.

  9. #9
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    I'm not into web development but reading to curl FAQ it stated that it relies on client side only. I don't know if this work like xp_cmdshell in SQL server that somehow can permits command execution.(if has permitted to the web user, complete negotiation of the webserver is quite predictable). No matter how helpful to admin over remote sites...it's still need some precautions.

  10. #10
    just sanitize your data properly to prevent sql injections

  11.    Advertisement

Page 1 of 3 123 LastLast

Similar Threads

 
  1. SQL 101
    By BadDudes in forum Programming
    Replies: 44
    Last Post: 08-31-2012, 07:34 AM
  2. Someone's attempt to sql inject my site - not!!! Hahahaha
    By dodie in forum Websites & Multimedia
    Replies: 22
    Last Post: 03-01-2009, 06:03 PM
  3. SQL Quiz!
    By maldito_guapito in forum Programming
    Replies: 45
    Last Post: 01-24-2006, 01:01 PM
  4. wat's d best sql back-end?
    By edshark in forum Software & Games (Old)
    Replies: 5
    Last Post: 09-15-2005, 04:41 PM
  5. HOW TO CONNECT SQL SERVER USING SQL AUTHENTICATION
    By edshark in forum Software & Games (Old)
    Replies: 13
    Last Post: 09-02-2005, 04:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top