implant


  Aktif KonularAktif Konular  Forum Üyelerini GösterÜye Listesi  Forumu AraArama  YardımYardım
  Kayıt OlKayıt Ol  GirişGiriş
ASP / ASP.NET
 ASPTurkiye.com Forum : ASP / ASP.NET
Konu Konu: sql injection hatası Yanıt YazYeni Konu Gönder
Yazanlarda
Mesaj << Önceki Konu | Sonraki Konu >>
sworda
Yeni Üye
Yeni Üye


Kayıt Tarihi: 17-Temmuz-2012
Gönderilenler: 1
Gönderen: 17-Temmuz-2012 Saat 17:03 | Kayıtlı IP Alıntı sworda

merhaba ,

aşağıdaki kod sql injection açığı veriyor
nasıldüzeltebilirim?

'set time session and disable caches
response.buffer = true
response.expires = 60
response.expiresabsolute = now() - 1
response.addheader "pragma","no-cache"
response.addheader "cache-control","private"
response.cachecontrol = "no-cache"
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>

<!--#include virtual="/includes/inc-dataconnection.asp"--
>
<!--#include virtual="/Includes/func-common.asp"-->
<!--#include virtual="/Includes/func-aspcode.asp"-->
<!--#include virtual="/Includes/func-content.asp"-->
<!--#include virtual="/Includes/func-encryption.asp"-->
<!--#include virtual="/Includes/inc-configuration.asp"-->

<%
'dimension variables
dim rsLogin, sqlLogin, intLoginCount, arrLoginData
dim strUsername, strPassword, strHeader, strMessage,
strAddress, strRedirect
dim intRemember

'load and check variables
strUsername = prepare_text(request.form("name"), true,
false)
strPassword = prepare_text(request.form("password"),
true, false)

if request.form("remember") <> "" and
isnumeric(request.form("remember")) = true then
     intRemember = request.form("remember")
else
     intRemember = 0
end if
%>

<title><%=page_title("Administration")%></tit le>

<%
Response.Charset = "windows-1254"
Session.LCID = 1055
Session.CodePage = 1254
%>

<meta http-equiv="Content-Type"
content="text/html;charset=windows-1254" />
<link rel="stylesheet" type="text/css" href="
<%=strBlogLocation%>Admin/Includes/inc-stylesheet.css" />
<link rel="shortcut icon" href="
<%=strBlogLocation%>Themes/<%=strBlogTheme%>/Com mon/favic
on.ico" />
<script type="text/javascript" src="
<%=strBlogLocation%>Includes/inc-javascript.js">< ;/script>

</head>

<body>

     <div id="container">

           <div id="header">
                <!--#include file="Includes/inc-
header.asp"-->
           </div>

           <div id="centre">

                 <div id="login">
                      <%
                      'check whether user is
logged in
                      if session("FB_UserID") =
"" then

                            'check whether
user has enetered any user details
                            if (strUsername =
"" and strUsername <> "name") and (strPassword = "" and
strPassword <> "password") then

                                 'display
login header
                                
response.write("<h1>" & strBlogTitle &" "& ids("Login")
&"</h1>")

                                 'display
login message
                                
response.write("<p>")
                                      
response.write(ids("Login_"))
                                
response.write("</p>")

                                 'display
login form
                                
response.write("<form action='login.asp' method='post'
onsubmit=""this.submit.disabled=true;"">")

                                      
response.write("<p>")
                                           
response.write("<label for='name'>"& ids("Username") &"
</label> <input id='name' name='name' type='text'
value=""name"" size='22' maxlength='80' tabindex='1'
onfocus=""this.value=''"" /> <label for='password'>"&
ids("Password") &"</label> <input id='password'
name='password' type='password' value=""password""
size='22' maxlength='80' tabindex='2'
onfocus=""this.value=''"" /> <label for='remember'>"&
ids("LoginRemember") &"</label> <input id='remember'
name='remember' type='checkbox' value='1' tabindex='3' />
<input id='submit' name='submit' type='submit'
tabindex='4' value="""& ids("Submit") &""" class='button'
/>")
                                      
response.write("</p>")

                                
response.write("</form>")

                           else

                                 'grab
details for the specified user name
                                 set
rsLogin = server.createobject("adodb.recordset")
                                 sqlLogin
= "SELECT User_ID, User_Name, User_Password,
User_Activation, User_Level, User_Ban_Expires,
User_Ban_Reason FROM FB_Users WHERE User_Name = '"&
strUsername &"';"
                                
rsLogin.cursorlocation = 3
                                
rsLogin.open sqlLogin, adoConn
                                 if not
(rsLogin.bof or rsLogin.eof) then
                                      
intLoginCount = rsLogin.recordcount
                                      
arrLoginData = rsLogin.getrows()
                                 else
                                      
intLoginCount = 0
                                 end if
                                
rsLogin.close
                                 set
rsLogin = nothing

                                
'increment query count
                                 intQuery
= intQuery + 1

                                 'check a
valid user has been specified
                                 if
intLoginCount = 0 then

                                      
'set error message
                                      
strHeader = ids("LoginError")
                                      
strMessage = "<p>"& ids("LoginErrorIncorrect") &"</p>"
                                      
strRedirect = "default.asp"

                                 else

                                      
'check account is activated
                                      
if arrLoginData(4, 0) = 0 then

                                           
'set error message
                                           
strHeader = ids("LoginError")

                                           
'check whether account authorisation is enabled
                                           
if intBlogAccountAuthorisation = 1 then

                                                
strMessage = "<p>" & ids("LoginErrorWaiting") &"</p>"

                                           
else

                                                
strMessage = "<p>"& ids("LoginErrorEmail") &"</p>"

                                           
end if

                                           
strRedirect = "default.asp"

                                      
end if

                                      
'check whether account has been banned
                                      
if arrLoginData(5, 0) > db_time(intBlogTimeOffset) then

                                           
'set error message
                                           
strHeader = ids("LoginError")
                                           
strMessage = "<p>" &
replace(replace(replace(ids("LoginErrorBanned"),"#REASON#
",SQL_decode(arrLoginData(6,
0))),"#TIME#",web_time(arrLoginData(5, 0),
strBlogTimeFormat,
"Time")),"#DATE#",web_time(arrLoginData(5, 0),
strBlogTimeFormat, "Date")) &"</p>"
                                           
strRedirect = "default.asp"

                                      
end if

                                      
'check that the correct password has been specified
                                      
if arrLoginData(2, 0) <> strPassword then

                                           
'set error message
                                           
strHeader = ids("LoginError")
                                           
strMessage = "<p>"& ids("LoginErrorPassword") &"</p>"
                                           
strRedirect = "default.asp"

                                      
end if

                                      
'check there has not been an error
                                      
if strHeader = "" then

                                           
'set session variables
                                           
session("FB_UserID") = arrLoginData(0, 0)
                                           
session("FB_UserName") = SQL_Decode(arrLoginData(1, 0))
                                           
session("FB_UserLevel") = arrLoginData(4, 0)

                                           
'write user details to session cookie
                                           
response.cookies(strBlogTitle)("ID") = arrLoginData(0, 0)
                                           
response.cookies(strBlogTitle)("Code") =
md5(arrLoginData(0, 0) &"-"& arrLoginData(3, 0))

                                           
'if specified set cookie expirey time
                                           
if intRemember = 1 then
                                                
response.cookies(strBlogTitle).expires = dateadd("yyyy",
1, now())
                                           
end if

                                           
'set user IP address
                                           
if request.servervariables("HTTP_X_FORWARDED_FOR") = ""
then
                                                
strAddress = request.servervariables("REMOTE_ADDR")
                                           
else
                                                
strAddress =
request.servervariables("HTTP_X_FORWARDED_FOR")
                                           
end If

                                           
'update users details
                                           
set rsLogin = server.createobject("adodb.recordset")
                                           
sqlLogin = "UPDATE FB_Users SET User_Date_Visit = '"&
db_time(intBlogTimeOffset) &"', User_Login_Count =
(User_Login_Count + 1), User_Address = '"& strAddress
&"', User_Ban_Expires = NULL, User_Ban_Reason = NULL
WHERE User_ID = "& arrLoginData(0, 0) &";"
                                           
rsLogin.cursortype = 2
                                           
rsLogin.locktype = 3
                                           
rsLogin.open sqlLogin, adoConn
                                           
set rsLogin = nothing

                                           
'increment query count
                                           
intQuery = intQuery + 1

                                           
'set confirmation message
                                           
strHeader = ids("Login") &" "& ids("Successful")
                                           
strMessage = "<p>"& ids("LoginSuccess") &"</p>"

                                           
'set redirection based on user level
                                           
if session("FB_UserLevel") > 2 then
                                                
strRedirect = "Admin/default.asp"
                                           
else
                                                
strRedirect = "default.asp"
                                           
end if

                                      
end if

                                 end if

                           end if

                      else

                           'clear session
variables
                           session.abandon()

                           'clear cookies
                           
response.cookies(strBlogTitle)("ID") = ""
                           
response.cookies(strBlogTitle)("Code") = ""
                           
response.cookies(strBlogTitle).expires = dateadd("d", -1,
now())

                           'set confirmarion
message
                           strHeader =
ids("Logout") &" "& ids("Successful")
                           strMessage = "
<p>"& ids("LogoutSuccess") &"</p>"
                           strRedirect =
"default.asp"

                      end if

                      if strMessage <> "" then

                           call
display_redirect(strHeader,strMessage,strRedirect)

                      end if
                      %>
                 </div>

                 <div class="clear"></div>
           </div>

           <div id="footer">
                <!--#include
virtual="/Includes/inc-footer.asp"-->
Yukarı Dön Göster sworda's Özellikler Diğer Mesajlarını Ara: sworda
 
fanatik
Üye
Üye


Kayıt Tarihi: 11-Nisan-2012
Gönderilenler: 76
Gönderen: 18-Temmuz-2012 Saat 10:22 | Kayıtlı IP Alıntı fanatik

sadece hata uyarısını ve hata satırını yazın

__________________
http://www.googledostu.com
Türk Sosyal İmleme Sitesi
Yukarı Dön Göster fanatik's Özellikler Diğer Mesajlarını Ara: fanatik Ziyaret fanatik's Ana Sayfa
 
Ahmet BOZ
Yeni Üye
Yeni Üye


Kayıt Tarihi: 19-Temmuz-2012
Ülke: Türkiye
Gönderilenler: 1
Gönderen: 17-Ağustos-2012 Saat 21:12 | Kayıtlı IP Alıntı Ahmet BOZ

Numerik değerleri

if not isnumeric(deger) then

response.redirect "default.asp"

end if

ile kontrol altına alın.
Yukarı Dön Göster Ahmet BOZ's Özellikler Diğer Mesajlarını Ara: Ahmet BOZ
 
fanatik
Üye
Üye


Kayıt Tarihi: 11-Nisan-2012
Gönderilenler: 76
Gönderen: 25-Ağustos-2012 Saat 19:03 | Kayıtlı IP Alıntı fanatik

Ahmet BOZ Yazdı:
Numerik değerleri

if not isnumeric(deger) then

response.redirect "default.asp"

end if

ile kontrol altına alın.

bi hesapla soru soruyor bi başka hesapla cevap veriyor lale.
çok ilginç



__________________
http://www.googledostu.com
Türk Sosyal İmleme Sitesi
Yukarı Dön Göster fanatik's Özellikler Diğer Mesajlarını Ara: fanatik Ziyaret fanatik's Ana Sayfa
 

Eğer Bu Konuya Cevap Yazmak İstiyorsanız İlk Önce Giriş
Eğer Kayıtlı Bir Kullanıcı Değilseniz İlk Önce Kayıt Olmalısınız

  Yanıt YazYeni Konu Gönder
Yazıcı Sürümü Yazıcı Sürümü

Forum Atla
Kapalı Foruma Yeni Konu Gönderme
Kapalı Forumdaki Konulara Cevap Yazma
Kapalı Forumda Cevapları Silme
Kapalı Forumdaki Cevapları Düzenleme
Kapalı Forumda Anket Açma
Açık Forumda Anketlerde Oy Kullanma

Powered by Web Wiz Forums version 7.91
Copyright ©2001-2004 Web Wiz Guide

Bu Sayfa 0,1094 Saniyede Yüklendi.