SQL-ինյեկցիա, ի՞նչ է սա

Բաժին` Հոդվածներ

ՄԱՍ 1.

SQL Injection-ը բավականին լավ գործիք է հակերի ձեռքին, որպեսզի ստանա ուրիշի սերվեր մուտք գործելու հնարավորություն: Եվ չնչին ցանկության դեպքում /իսկ հակերների մոտ այդ չնչին ցանկությունը այլ մարդկանց համար ահռելի մեծ է/ նա կստանա այդ հնարավորությունը :)

Coder inside

Մեր ժամանակներում, տվյալների բազայի հետ աշխատում են համարյա բոլոր ծրագրավորման լեզուներով, օրինակ` BASIC, C++, Java, PERL, PHP, Assembler և նույնիսկ JavaScript! Շատ հաճախ տվյալների բազան օգտագործում են ֆինանսական որոշակի խնդիրների լուծումների, հաշվապահության, կադրերի կառավարման և շատ այլ ոլորտների մեջ, բայց իրենց մեծ տարածումը տվյալների բազաները գտան հենց ինտերնետում:

Տվյալների բազաները հաճախ օգտագործվում են ՎԵԲ ԾՐԱԳՐԱՎՈՐՄԱՆ մեջ: Նրանք օգնության են հասնում օրինակ գրանցված անդամների տվյալների պահպանման, կայքում որոնում իրականացնելու և շատ այլ դեպքերում: Տվյալների բազաներին դիմելու համար օգտագործվում են այսպես ասած սերվերային տեխնոլոգիաները, ինչպիսիք են` PHP, PERL, ASP և այլն: Ու հենց այստեղից էլ սկսվում է ամենահետաքրքիրը:  Որովհետև երբ սերվերի վրա տեղադրված են բոլոր թարմացումները, իսկ ֆայրվոլն արգելափակում է մուտքը բոլոր պորտերով, բացի 80-ից, կամ երբ անհրաժեշտ է մուտք գործել համակարգ` որոշակի տվյալների համար, հակերին միայն մնում է օգտվել ինչի՞ց… Դե իհարկե  SQL Injection-ից/այսուհետ SQL-ինյեկցիա/: Այս “գործողության” իմաստը կայանում է ՎԵԲ ՏԵԽՆՈԼՈԳԻԱՆԵՐԻ սխալների օգտագործումը SQL-ի օգնությամբ: Բանը նրանում է, որ շատ վեբ կայքեր, իրենց գրանցված անդամների տվյալների մշակման համար կազմում են որոշակի SQL-հրամաններ, որոնք կատարում են փոփոխություններ տվյալների բազայի մեջ:  Այս հրամանների օգտագործումը կարող է հանգեցնել հետաքրքիր արդյունքների…

SQL Injection

Հարձակման այս մեթոդը հասկանալու համար պատկերացրեք, թե մտել եք մի կայք, որպեսզի ներբեռնեք շատ կարևոր ինֆորմացիա, բայց պարզում եք, որ այդ ինֆորմացիան կարող է ներբեռնել միայն գրանցված անդամը, իսկ գրանցումը վճարովի է :) Իսկական ժամանակն է հիշել, թե ինչպիսի խնամքով պետք է վերաբերվել  SQL տվյալների բազային: Օրինակ լոգինի և գաղտնաբառի ստուգումը կատարող կոդը կարող է ունենալ հետևյալ տեսքը`

$result=mysql_db_query($db,"SELECT * FROM $table WHERE user='$login' AND
pass='$password'");
$num_rows=mysql_num_rows($result);
mysql_close($link);
if ($num_rows!=0)
{
// AUTHENTICATION OK
}
else
{
// AUTHENTICATION ERROR
}

Ես ավելացրել եմ երկու մեջբերում, առաջինը` “AUTHENTICATION OK “, որի փոխարեն պետք գրված լինի ճիշտ մուտքագրված տվյալների դեպքում կատարվող կոդը, իսկ երկրորդը` “AUTHENTICATION ERROR “, որին էլ պետք է փոխարինի սխալ մուտքագրված տվյալների դեպքում կատարվող կոդը: Ֆորման լրացնելուց հետո, բրաուզերում կարող ենք տեսնել մոտավորապես էսպիսի մի տող` http://www.server.com?login=user&password=31337, որտեղ  www.server.com-ը այն սերվերի անունն է, որի մեջ փորձում ենք մխրճվել: Հիմա փորձենք պատկերացնել թե ինչ SQL հարցում կարող է զբաղվել մեր մուտքագրած տվյալների մշակմամբ: Այն մոտավորապես կունենա հետևյալ տեսքը`

SELECT * FROM users WHERE login='user' AND password='31337'

Սա մոտավոր նշանակում է հետևյալը` վերադարձրու ինձ users աղյուսակի բոլոր այն տվյալները, որոնց լոգինը user է, իսկ գաղտնաբառը` 31337: Եթե գոյություն ունի այդպիսի տվյալ, ուրեմն տվյալ մարդը գրանցված է… Բայց որոշ հատուկ դեպքերում, ամեն ինչ կարելի է ձևափոխել: Հաշվի է առնվում այն հանգամանքը, որ SQL-ում կան AND և OR հրամաններ, որոնք համապատասխանաբար նշանակում են ԵՎ, ԿԱՄ :  Օրինակ ինչն է մեզ խանգարում հարցումը կատարել այսպես`

SELECT * FROM users WHERE login='user' AND password='31337' AND email='user@server.com'

Այս դեպքում կստուգվի նաև email փոփոխականը: Բայց եկեք կանգ չառնենք ԵՎ-ի վրա, որովհետև մեզ ավելի շատ հետաքրքիր է նրա ընկերը` ԿԱՄ-ը: Օրինակ ինչ կլինի եթե գրենք հարցումն այսպես`

SELECT * FROM users WHERE login='user' OR 1=1--' AND password='31337'

Նախ ասեմ, որ երկու գծերը` “–”, նշանակում են որ հարցումն այդքանով ավարտվում է, և դրանից հետո եկող տվյալները չեն ընթերցվում համակարգի կողմից! Ստացվում է, որ մենք կատարել ենք հետևյալ հարցումը`

SELECT * FROM users WHERE login='user' OR 1=1

Ինչպես տեսնում եք, մենք ավելացրեցինք ևս մեկ պայման`”1=1″, այսինքն համակարգը կտա մեզ ճիշտ արդյունք, եթե լոգինը լինի  user կամ 1=1: Բայց մաթեմատիկան մեզ հուշում է, որ 1-ը հենց հավասար է 1-ին (չնայած ինչեր ասես հիմա չեն հորինի :-D ): Դե իսկ հիմա, մեր SQL հարցումը տեղափոխենք բրաուզեր` http://www.server.com?login=user or 1=1–&password=31337 :  Սա հանգեցնում է նրան, որ կապ չունի թե մենք ինչ լոգին ենք լրացրել, իսկ համակարգը մեզ ճիշտ արդյունքն է վերադարձնում:

Բայց այս ամբողջն ընդհամենը թեորիա է: Պրակտիկայում մեզ անհայտ է, թե ինչպես է կատարվում հարցումը, ինչ պարամետրեր են փոխանցվում և ինչ հաջորդականությամբ: Դրա համար նույն գործողությունը`”user’ OR 1=1–”, պետք է կատարել բոլոր փոփոխականների համար: Ինչպես նաև պետք է ստուգել ուղարկող ֆորմայի մեջ արդյոք կան թաքնված փոփոխականներ, որոնք սովորաբար լինում են այս տեսակի` “<INPUT TYPE=HIDDEN VALUE=’value’ >”: Եվ որ ամենակարևորն է, պետք է իմանալ, թե իրականում ինչ անունով սկրիպտ է ստանալու Ձեր ուղարկած տվյալները:

Իսկ ինչ վերաբերում է իմ բերած օրինակին, այն կարող էր լինել օրինակ այսպիսին`

SELECT * FROM users WHERE (login='user' AND password='31337')
SELECT * FROM users WHERE login="user" AND password="31337"
SELECT * FROM users WHERE login=user AND password=31337

և այլն…

Այս դեպքում պետք է փորձել բոլոր հնարավոր տարբերակները`

‘ OR 1=1–
” OR 1=1–
OR 1=1–
‘ OR ‘a’=’a
” OR “a”=”a
‘) OR (’a’=’a
OR ‘1′=’1′

Ամեն ինչ կախված է սկրիպտը գրող վեբ ծրագրավորողից և նրանից, թե ինչի համար է գրված սկրիպտը: Դե քանի որ ամեն մարդ սովոր է աշխատանքը կատարել իր ոճով, շատ հավանական է, որ ծրագրավորողը ընտրած լինի ամենադժվար տարբերակը: Դրա համար էլ պետք չէ հանձնվել, եթե համակարգը հանկարծ չընդունի Ձեր կողմից տրված տվյալները: Պետք է սոտւգել հնարավորինս շատ տարբերակներ:

— Շարունակելի —

Վարդան Գրիգորյան / iReport.am / blog.grigoryan.biz

4,781 Responses to “SQL-ինյեկցիա, ի՞նչ է սա”

  1. Hi there very cool web site!! Man .. Beautiful .. Amazing .. I’ll bookmark your site and take the feeds additionally¡KI’m glad to search out a lot of helpful info here in the submit, we need develop extra strategies on this regard, thank you for sharing. . . . . .

  2. I am wondering which blogging and site-building platform you might be running? I’m new to operating a blog and have been thinking about using the Hubpages platform. Do you consider this is a good foundation to start with? I would be extremely grateful if I could ask you some questions through email so I can learn a bit more before getting started. When you have some free time, please contact me at: jacquesklein@live.fr. Thanks a lot

  3. Wonderful goods from you, man. SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net I’ve understand your stuff previous to and you are just extremely fantastic. I actually like what you have acquired here, certainly like what you are saying and the way in which you say it. You make it enjoyable and you still take care of to keep it sensible. I cant wait to read far more from you. This is really a great SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net informations.

  4. Great goods from you, man. SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net I’ve understand your stuff previous to and you are just too fantastic. I actually like what you have acquired here, certainly like what you’re saying and the way in which you say it. You make it entertaining and you still take care of to keep it sensible. I can not wait to read far more from you. This is really a tremendous SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net informations.

  5. Haywood Okey says:

    I have been surfing online more than three hours today, but I never discovered any fascinating article like yours. It’s beautiful price sufficient for me. In my opinion, if all web owners and bloggers made excellent content as you probably did, the internet will probably be much more useful than ever before.

  6. Good post. I be taught something more challenging on totally different blogs everyday. It’s going to at all times be stimulating to read content material from different writers and follow somewhat one thing from their store. I’d prefer to make use of some with the content material on my blog whether you don’t mind. Natually I’ll give you a link on your web blog. Thanks for sharing.

  7. I got what you wish, thanks for putting up. Woh I am cheerful to hit this website finished google. Thanks For Share SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net.

  8. I got what you wish, thanks for swing up. Woh I am glad to mature this website through google. Thanks For Share SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net.

  9. I got what you mean, thanks for swing up. Woh I am glad to chance this website finished google. Thanks For Share SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net.

  10. Rutha Nizo says:

    Hi, I think your site might be having browser compatibility issues. When I look at your blog in Safari, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, great blog!

  11. An fascinating language is designer scuttlebutt. I conceive that you should compose many on this topic, it mightiness not be a sacred message but mostly grouping are not enough to utter on specified topics. To the next. Cheers like your SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net.

  12. An newsworthy language is worth statement. I believe that you should make solon on this subject, it power not be a inhibition issue but generally group are not enough to communicate on such topics. To the succeeding. Cheers like your SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net.

  13. Hiya, I am really glad I have found this information. Today bloggers publish just about gossips and web and this is actually irritating. A good site with interesting content, this is what I need. Thanks for keeping this site, I’ll be visiting it. Do you do newsletters? Can’t find it.

  14. SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net I was suggested this website by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my difficulty. You are amazing! Thanks! your article about SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net Best Regards Schaad Rolf

  15. SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net I was recommended this website by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are incredible! Thanks! your article about SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net Best Regards Rolf Andy

  16. Thanks for sharing your ideas on this blog. In addition, a fantasy regarding the lenders intentions any time talking about foreclosed is that the financial institution will not have my repayments. There is a fair bit of time in which the bank is going to take payments in some places. If you are too deep within the hole, they’ll commonly demand that you pay the actual payment in full. However, that doesn’t mean that they will have any sort of installments at all. In the event you and the standard bank can be capable to work a thing out, this foreclosure procedure may cease. However, in case you continue to skip payments wih the new program, the property foreclosures process can just pick up from where it left off.

  17. I simply could not depart your web site before suggesting that I really enjoyed the standard info an individual provide in your visitors? Is gonna be again often in order to check out new posts

  18. In trying to find sites related to hosting and specifically comparability internet hosting linux plan web, your web site got here up. :) http://www.ofis.getlisted.co.nz/office-partitions-auckland

  19. An riveting communication is designer statement. I consider that you should compose author on this issue, it mightiness not be a prejudice study but generally fill are not enough to mouth on such topics. To the next. Cheers like your SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net.

  20. Josh Dadlani says:

    Thanks for the concepts you are revealing on this website. Another thing I want to say is that often getting hold of duplicates of your credit rating in order to check accuracy of each detail could be the first measures you have to execute in credit score improvement. You are looking to cleanse your credit history from dangerous details mistakes that wreck your credit score.

  21. I enjoy reading a post that will make people think. Also, thanks for allowing me to comment!

  22. After I originally commented I clicked the -Notify me when new feedback are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any method you’ll be able to take away me from that service? Thanks!

  23. quality post, I’m sharing it on FB!

  24. Thanks for the sensible critique. Me & my neighbor were just preparing to do just a little research about this. We got a grab a book from our region library but I think I learned far more from this post. I’m really glad to see such fantastic data being shared freely out there.

  25. I am not sure where you’re getting your info, but good topic. I needs to spend some time learning more or understanding more. Thanks for excellent info I was looking for this SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net for my mission.

  26. I am not sure where you’re getting your info, but good topic. I needs to spend some time learning much more or understanding more. Thanks for great info I was looking for this SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net for my mission.

  27. I am not sure where you’re getting your info, but great topic. I needs to spend some time learning much more or understanding more. Thanks for excellent info I was looking for this SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net for my mission.

  28. Magnificent goods from you, man. SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net I have understand your stuff previous to and you’re just extremely magnificent. I really like what you have acquired here, really like what you are saying and the way in which you say it. You make it entertaining and you still care for to keep it smart. I can not wait to read far more from you. This is really a great SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net informations.

  29. Magnificent goods from you, man. SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net I’ve understand your stuff previous to and you’re just extremely fantastic. I really like what you’ve acquired here, really like what you’re saying and the way in which you say it. You make it entertaining and you still care for to keep it smart. I can’t wait to read much more from you. This is really a terrific SQL-ինյեկցիա, Õ«ÕžÕ¶Õ¹ Õ§ Õ½Õ¡ | Hi-Secure.net informations.

  30. Vern Bogh says:

    I don’t even know how I stopped up right here, however I believed this post was once good. I don’t understand who you might be but certainly you are going to a well-known blogger if you happen to are not already ;) Cheers!

  31. SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net I was suggested this web site by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my trouble. You are wonderful! Thanks! your article about SQL-ինյեկցիա, ի՞նչ է սա | Hi-Secure.net Best Regards Schaad Yoder

Leave a Reply


  Գովազդ
sharepoint webparts | бюро переводов в москве | переводчик с английского языка