¾È±Ô °øºÎ¹æ

security > flieUpload hacking ÆÄÀϾ÷·Îµå ÇØÅ·

µî·ÏÀÏ : 2017-06-30 15:26 Á¶È¸¼ö : 94,400

ÆÄÀϾ÷·Îµå Ãë¾àÁ¡Àº °ø°ÝÀÌ ¼º°øÇÏ¸é ¹Ù·Î ¼­¹ö°¡ ÇØÅ·ÀÌ µÇ´Â °ÍÀ̱⠶§¹®¿¡ °¡Àå ¸®½ºÅ©°¡ Å« Ãë¾àÁ¡ ÀÔ´Ï´Ù.
±×·¡¼­ Àý´ë·Î À¥½©ÀÌ ¾÷·Îµå°¡ µÇÁö ¾Êµµ·Ï ÇØ¾ß ÇÕ´Ï´Ù.
±Ùº»ÀûÀ¸·Î ´ëÀÀÇÏ´Â ¹æ¹ýÀº °£´ÜÇÕ´Ï´Ù.
ÆÄÀÏÀÌ ¾÷·Îµå µÇ´Â ¼­¹ö³ª Æú´õ¿¡ ¼­¹ö»çÀÌµå ½ºÅ©¸³Æ® ½ÇÇà ±ÇÇÑÀ» Á¦°ÅÇØ ¹ö¸®¸é µË´Ï´Ù.
±×·¯¸é À¥½©ÀÌ ¾÷·Îµå µÇ´õ¶óµµ asp, php, jsp µîÀÌ ½ÇÇàÀÌ µÇÁö ¾Ê±â ¶§¹®¿¡ ¹®Á¦°¡ ¾ø½À´Ï´Ù.
ÆÄÀÏ ¾÷·Îµå Æú´õ¿¡¼­ ½ºÅ©¸³Æ® ½ÇÇà ±ÇÇÑÀ» Á¦°ÅÇÏ·Á¸é ¿ì¼± À¥ ÆäÀÌÁö Æú´õ¿Í ¾÷·Îµå ÆÄÀÏ Æú´õ¸¦ ºÐ¸®ÇØ¾ß ÇÕ´Ï´Ù.
(¼­¹ö´ÜÀ§·Î ºÐ¸®Çϴ°ÍÀÌ °¡Àå ÁÁÀº ¹æ¹ýÀÌ°ÚÁö¸¸ Æú´õ ´ÜÀ§·Îµµ ±ÇÇÑÀ» Á¦¾îÇÒ ¼ö ÀÖ½À´Ï´Ù.)
±âÁ¸¿¡ ºÐ¸®µÇ¾î ÀÖ´Ù¸é ½ºÅ©¸³Æ® ½ÇÇà±ÇÇÑÀÌ ÀÖ´ÂÁö¸¸ È®ÀÎÇÏ°í, ÀÖÀ»°æ¿ì »èÁ¦ÇØ ¹ö¸®¸é ³¡ÀÔ´Ï´Ù.
ÀÏ´Ü Á¶»ç¸¦ ÇØ¾ß ÇÒ°ÍÀÔ´Ï´Ù.
¾î´À ¸Þ´º°¡ ÆÄÀÏ ¾÷·Îµå ±â´ÉÀ» °¡Áö°í ÀÖ´ÂÁö ¸ðµÎ Á¶»ç¸¦ ÇØ¾ß ÇÕ´Ï´Ù.
¿Ö³ÄÇÏ¸é ¸ðµç ¸Þ´ºÀÇ ÆäÀÌÁö¿¡¼­ ´ëÀÀÀ» ÇØ¾ß Çϴϱî¿ä..
¸ðµç ¸Þ´ºÀÇ ÆÄÀÏ ¾÷·Îµå ·ÎÁ÷À» ÀÏÀÏÀÌ È®ÀÎÇÏ°í À¥½©°°Àº ¾ÇÀÇÀûÀÎ ÆÄÀÏÀÌ ¾÷·Îµå µÉ ¼ö ÀÖ´ÂÁö üũÇØ¾ß ÇÕ´Ï´Ù.

window2008 ¼­¹ö¿¡¼­ ÆÄÀϽÇÇà±ÇÇÑ Á¦°Å ¹æ¹ý



1. iis¿¡¼­ ½ÇÇà±ÇÇÑÀ» Á¦°ÅÇÏ°íÀÚ ÇÏ´Â Æú´õ¸¦ Ŭ¸¯ÇÕ´Ï´Ù.

2. 󸮱â¸ÅÇÎÀ» Ŭ¸¯ÇÕ´Ï´Ù.



3. ¸¶¿ì½º ¿À¸¥ÂÊÅ°¸¦ ´­·¯ ±â´É»ç¿ë±ÇÇÑ ÆíÁýÀ» Ŭ¸¯ÇÕ´Ï´Ù.



4. ½ºÅ©¸³Æ® Ç׸ñ ¼±ÅÃÀ» ÇØÁ¦ ÈÄ È®ÀιöÆ°À» ´©¸¨´Ï´Ù. ÆäÀÌÁö ·¹º§¿¡¼­ ´ëÀÀÇÏÁö ¾Ê°í IPS¸¦ È°¿ëÇϸé Çѹø¿¡ ÇØ°áÇÒ ¼ö ÀÖÁö ¾ÊÀ»±î ÇÏ´Â »ý°¢À» ÇØ º¼¼ö°¡ ÀÖÁö¸¸ Á¦ °æÇè»ó IPS¸¸À¸·Î´Â ÇÑ°è°¡ ÀÖ½À´Ï´Ù.

¿Ö³ÄÇϸé ÆÐÅÏÀ¸·Î µî·ÏÇؼ­ ¹æ¾îÇÒ ¼öµµ ÀÖ°ÚÁö¸¸ ÀÌ Ãë¾àÁ¡ ¸¸Å­Àº 100% ¿Ïº®ÇÏ°Ô ¸·¾Æ¾ß Çϱ⠶§¹®¿¡ ¿ìȸ°¡ °¡´ÉÇÑ IPS¸¸À¸·Î´Â ¾î·ÆÁÒ..
(±×·¸´Ù°í IPS¸¦ »ç¿ëÇÒ ÇÊ¿ä°¡ ¾ø´Ù´Â °ÍÀº ¾Æ´Õ´Ï´Ù. IPS°¡ ÀÖ´Ù¸é ÃÖ´ëÇÑ È°¿ëÀ» Çϴ°ÍÀÌ ¿øÄ¢ÀÌÁÒ//)
ÀÏ´Ü IPS¿¹±â°¡ ³ª¿Â±è¿¡ ÆÐÅÏÀÌ¶óµµ º¸°í °¡°Ú½À´Ï´Ù.
¾Æ¹«·¡µµ À¥½©ÀÌ´Ù º¸´Ï OS ¸í·É¾î¸¦ ½ÇÇàÇÒ ¼ö ÀÖ´Â ½ºÅ©¸³Æ® ÇÔ¼ö°¡ ÆÐÅÏÀ̶ó ÇÒ ¼ö Àְڳ׿ä..
 
asp / aspx : 

cmd.exe
WScript.Shell 
Scripting.FileSystemObject
ADOX.Catalog
Adodb.connection
VBScript.Encode
CODEPAGE
"949"
<%execute
Language="C#"
System.Reflection
VBScript.Encode
script runat
WScript.ShellApp
WSCRIPT.NETWORK
Shell.ApplicationApp
Adodb.Connection
Adodb.RecordSet
Adodb.Stream
Scripting.FileSystemObject
SoftArtisans.FileUp
Provider=SQLOLEDB.

µîµî



jsp :

jdbc.sqlserver
jdbc:microsoft
sun.jdbc.
.OracleDriver
jdbc:mysql:
Runtime.
.exec
out.println
import="java.io

µîµî


php :
popen(
exec(
fopen(
system( 
passthru(
escapeshellcmd(
$_SERVER

µîµî
°¢°¢ÀÇ ¾÷·Îµå ÆäÀÌÁö ·¹ºô¿¡¼­ À¥½©À» üũÇÏ´Â ·ÎÁ÷¿¡ ´ëÇؼ­ ¾Ë¾Æº¸°Ú½À´Ï´Ù.

À¥½©À» üũÇÏ´Â ·ÎÁ÷Àº ¾Æ·¡¿Í °°Àº ¹æ¹ýÀÌ ÀÖ½À´Ï´Ù.
  1. È®ÀåÀÚ Ã¼Å©
  2. mime type üũ
  3. ; , %00, %zz üũ

1. ¾÷·Îµå µÇ´Â ÆÄÀÏÀÇ È®ÀåÀÚ Ã¼Å©´Â °¡Àå ±âº»ÀûÀ̸ç ÇʼöÀÔ´Ï´Ù.
  ¸ðµç È®ÀåÀÚ¸¦ Á¦ÇÑÇÏ°í Çã¿ëÇÏ´Â ÀϺΠȮÀåÀÚ¸¸ ¾÷·Îµå µÇµµ·Ï Á¦ÇÑÇÏ´Â °ÍÀÌ ±âº»ÀÔ´Ï´Ù.
  È®ÀåÀÚ¸¦ üũÈú¶§´Â µÚ¿¡¼­ ºÎÅÍ Ã¼Å©¸¦ ÇØ¾ß ÇÕ´Ï´Ù.
  shell.gif.asp  shell.jpg.jsp µîÀ¸·Î È®ÀåÀÚüũ ¿ìȸ Å×Å©´ÐÀº ±âº»ÁßÀÇ ±âº»À̴ϱî¿ä..

2. µÎ¹ø°´Â mime-type üũÀÔ´Ï´Ù.
  À̹ÌÁö ÆÄÀÏÀÏ °æ¿ì´Â image/pjpeg, image/gif ÀÌ°ÚÁö¸¸ À¥½©°°Àº ÅؽºÆ® Çü½ÄÀÏ °æ¿ì´Â txt/html Çü½ÄÀÏ °ÍÀÔ´Ï´Ù.
  ¹°·Ð mime-type Àº °£´ÜÇÑ Á¶ÀÛ¿¡ ÀÇÇؼ­ ¿ìȸ°¡ µÇ°ÚÁö¸¸..
  ±âº»ÀûÀ¸·Î È®ÀåÀÚ Ã¼Å©¿Í °°ÀÌ Çϴ°ÍÀ» ±ÇÀåÇÕ´Ï´Ù.

3. Ư¼ö¹®ÀÚ Ã¼Å©
   ÆÄÀÏ¸í¿¡ Ư¼ö¹®ÀÚ°¡ ÀÖ´ÂÁö üũÇÕ´Ï´Ù.  -> %00 , %zz, ;
   %00 À̳ª %zz ´Â Á¾´Ü¹®Àڷμ­ ÆÄÀϼ­¹ö°¡ ¸®´ª½º ½Ã½ºÅÛÀÏ °æ¿ì ¿ìȸ ±â¹ýÀ¸·Î »ç¿ëÇÕ´Ï´Ù.

   ¿¹¸¦µé¾î ÆÄÀϸíÀ» shell.jsp%00.gif  ·Î ¾÷·Îµå Çϸé È®ÀåÀÚ Ã¼Å©´Â ¿ìȸÇÒ ¼ö ÀÖ½À´Ï´Ù.
   ±×¸®°í ¼­¹ö¿¡ ÀúÀåµÇ¾î È£ÃâµÉ¶§ ½Ã½ºÅÛÀÌ %00, %zz ¸¦ Á¾·á¹®ÀÚ·Î ÀνÄÇÏ¿©
  shell.jsp ·Î È£ÃâÀ» ÇßÀ»¶§ jsp·Î ½ÇÇàµÇ´Â °æ¿ì°¡ ÀÖ½À´Ï´Ù.

  ¼¼¹ÌÄÝ·Ð(;) °°Àº °æ¿ì´Â À©µµ¿ì IIS ÀÇ Ãë¾àÁ¡ÀÔ´Ï´Ù.

  shell.asp;.jpg  ·Î ÆÄÀϸíÀ» ¾÷·Îµå Çϸé È®ÀåÀÚ Ã¼Å©¸¦ ¿ìȸÇÒ ¼ö Àִµ¥ shell.asp ·Î È£ÃâÀ» ÇÏ´Ï È£ÃâÀÌ µË´Ï´Ù.
  ¼¼¹ÌÄÝ·Ð(;) À̳ª ¹°À½Ç¥(?)  ´Â URL¿¡¼­ URI¿Í ÆĶó¸ÞÅ͸¦ ±¸ºÐÇÏ´Â ¹®ÀÚÀÔ´Ï´Ù.

  ¿¹: http://www.xxx.co.kr/xxx.asp;xxxx=111
  URL : http://www.xxx.co.kr/xxx.asp;xxxx=111  URI : http://www.xxx.co.kr/xxx.asp   ÀÎÀÚ°ª : xxxx=111

  ±×·¡¼­ÀÎ Áö´Â ¸ô¶óµµ IIS ¿¡¼­ È£ÃâÇÒ¶§ shell.asp;.jpg ÆÄÀÏÀ» shell.asp ·Î È£ÃâÇϸé asp ·Î Á¤»ó È£ÃâÀÌ µË´Ï´Ù.
  IISÀÇ ¹Ùº¸°°Àº ¹ö±×ÀÌÁÒ.

  ÀÌÁ¤µµ üũ¸¦ ÇØ¾ß ¾È½ÉÇÒ ¼ö ÀÖ½À´Ï´Ù.
  ¿©±â¿¡´Ù°¡ ÆÄÀÏ À̸§Àº ³­¼öÈ­ ½ÃÄѼ­ ÀúÀåÇÑ´Ù´øÁö, ¾Æ¿¹ È®ÀåÀÚ¸¦ °­Á¦·Î ºÙ¿©¹ö¸®´Â ·ÎÁ÷À» ±¸ÇöÇÑ´Ù¸é ´õ ¾ÈÀüÇÒ °ÍÀÔ´Ï´Ù.
 

g_file1=UploadForm("g_file1")
if Len(g_file1)>0 then  
	att_file=UploadForm("g_file1").filepath 
	filesize1=UploadForm("g_file1").size  
	if filesize1<20000000 then   
		filename=mid(att_file, InstrRev(att_file,"\")+1)		//ÆÄÀϸí+È®ÀåÀÚ¸¦ »Ì´Â´Ù.
		strname=Mid(filename, 1, InstrRev(filename,".")-1)		//ÆÄÀÏ¸í¸¸ »Ì´Â´Ù.
		
		strname	 = file_StrDelete(strname)
		
		strExt=Mid(filename,InstrRev(filename,".")+1)			//È®ÀåÀÚ¸¸ »Ì´Â´Ù.
		strExt=Lcase(strExt)
		fnc_strExt_block(strExt)

		bExist=True 
		strfilename = strname & "." & strExt 
		cntFile	    = 0 

		do while bExist 
			if (FSO.FileExists(DIR_O_CODE&"/"&strfilename)) then
				cntfile = cntfile+1
				strfilename= strname&"_"&cntfile&"."&strExt  
			else 
				bExist=false
			end if
		Loop
		
		filename1	= strfilename
		strfilename		= DIR_O_CODE &"/"& strfilename
		UploadForm("g_file1").SaveAs strfilename  
	else
		Alert_back "È­ÀÏ ¿ë·®ÀÌ 20MÀ» ÃÊ°úÇÒ¼ö ¾ø½À´Ï´Ù."
	end if   	
end if
À§ ¼Ò½º¿¡¼­ °¡Àå Áß¿äÇÏ°Ô ÇÊÅ͸µ ÇÒ ºÎºÐÀÌ ¾Æ·¡ ºÎºÐÀÔ´Ï´Ù.

strname = file_StrDelete(strname)

ÆÄÀϸí°ú È®ÀåÀÚ¸¦ ±¸ºÐÇÑ ´ÙÀ½ file_StrDelete() ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ­ ÆÄÀϸíÀ¸·Î µÈ ¹®ÀÚ¿­À» ÇÊÅ͸µÇÏ°Ô µË´Ï´Ù.
ÆÄÀÏ¸í¿¡ ÀǽɵǴ ¹®ÀÚ³ª, Ư¼ö¹®ÀÚµîÀ» Á¦°ÅÇØ ÁÝ´Ï´Ù.
¾Æ·¡´Â file_StrDelete() ÇÔ¼ö ÀÔ´Ï´Ù. ÇÊÅ͸µ ÇØ¾ß ÇÒ ¹®ÀÚ°¡ ´õ ÀÖ´Ù¸é ¼Ò½º¿¡ Ãß°¡¸¸ ÇÏ¸é µË´Ï´Ù.
 
	'------------------- ƯÁ¤ ¹®ÀÚ »èÁ¦ ÇÔ¼ö -----------------------
	Function file_StrDelete(strmessage)
		StrDelete=Replace(strmessage,".","")
		StrDelete=Replace(StrDelete,"&","")
		StrDelete=Replace(StrDelete,"%","")
		StrDelete=Replace(StrDelete," ","")
		StrDelete=Replace(StrDelete,",","")
		StrDelete=Replace(StrDelete,"?","")
		StrDelete=Replace(StrDelete,"@","")
		StrDelete=Replace(StrDelete,"$","")
		StrDelete=Replace(StrDelete,"!","")
		StrDelete=Replace(StrDelete,"^","")
		StrDelete=Replace(StrDelete,"*","")
		StrDelete=Replace(StrDelete,"(","")
		StrDelete=Replace(StrDelete,")","")
		StrDelete=Replace(StrDelete,"+","")
		StrDelete=Replace(StrDelete,";","")
		StrDelete=Replace(StrDelete,"#","")
		StrDelete=Replace(StrDelete,"=","_")
		StrDelete=Replace(StrDelete,"'","")
		file_StrDelete=StrDelete
	End Function
µÎ¹ø°·Î Áß¿äÇÑ ¼Ò½ºÆ® fnc_strExt_block(strExt) ¸í·ÉÀÔ´Ï´Ù.
fnc_strExt_block() ÇÔ¼ö´Â ƯÁ¤ÇÑ È®ÀåÀÚ¸¸À» ¾÷·Îµå ÇÒ¼ö ÀÖ´Â ±â´ÉÀÔ´Ï´Ù.
aspÀÇ °æ¿ì , asp, dll, cer, php, exe µîÀ¸·Î ¸·¾Æ ³õÀ¸¸é, ¾ó¸¶µçÁö È®ÀåÀÚ¸¦ ¿ìȸÇؼ­ ¾÷·Îµå ÇÒ ¼ö ÀÖ½À´Ï´Ù.
ÀÌ·± °æ¿ì ¼­¹ö°¡ À§ÇèÇØ Áú ¼ö ÀÖÀ¸´Ï,
°³¹ßÀÚ°¡ Çã°¡ÇÑ È®ÀåÀÚ¸¸ ¿Ã¸®°Ô²û ¸·¾Æ ³õ´Â°Ô °¡Àå ¾ÈÀüÇÕ´Ï´Ù.

	'----------ÆÄÀÏ ¾÷·Îµå½Ã È®ÀåÀÚ Ã¼Å© ----------
	Function fnc_strExt_block(strExt)					
		strExt = Lcase(strExt)
		chk="X"
		select case strExt
			'À̹ÌÁö ÆÄÀÏ
			Case "gif","jpeg","bmp","tif","tiff","jpg","png","psd","au","ogg"
				chk="O"
			'¾ÐÃà ÆÄÀÏ
			Case "zip","alz","a01","a02","a03","egg"
				chk="O"
			'¹®¼­ ÆÄÀÏ
			Case "doc","hwp","xls","xlsx","ppt","pptx","csv","txt","doc","pdf","docx"
				chk="O"
			'³ìÃë ÆÄÀÏ
			Case "wav","avi","mp3","mpg","mpeg"
				chk="O"
			'Ç÷¹½¬ ÆÄÀÏ
			Case "swf"
				chk="O"
		end select	
		
		If chk="O" Then
		Else
			Response.write  "ÆÄÀϸíÀÇ È®ÀåÀÚ¸¦ È®ÀÎÇØ ÁÖ¼¼¿ä!  
				(À̹ÌÁö ÆÄÀÏ : gif , jpg , bmp , tif , tiff , png , psd , au , ogg) 
				(¾ÐÃà ÆÄÀÏ : zip ,alz, a01 , a02 , a03 ) 
				(¹®¼­ÆÄÀÏ : doc , hwp , xls , xlsx , ppt , pptx, csv , txt , doc , pdf ) 
				(³ìÃë ÆÄÀÏ : wav , avi , mp3) 
				(Ç÷¹½¬ ÆÄÀÏ : swf , fla ) À§¿¡ ¾ð±ÞÇÑ ÆÄÀϸ¸ ¾÷·Îµå ÇÒ ¼ö ÀÖ½À´Ï´Ù."
				Response.end
		End If
	End Function 
ÆÄÀÏ ¾÷·Îµå, Áï À¥½©ÀÌ ¾÷·Îµå µÉ ¼ö ÀÖ´Â Ãë¾àÁ¡Àº 99.9% °¡ ¾Æ´Ñ 100% ¸·¾Æ¾ß ÇÏ´Â Ãë¾àÁ¡ÀÏ °ÍÀÔ´Ï´Ù.
¹«½¼ ¼ö¸¦ ½á¼­¶óµµ ¸·¾Æ¾ß Çϴµ¥.. À¥º¸¾ÈÀ̶ó´Â°ÍÀÌ ÇØÅ·Çϴ°ͺ¸´Ù ¸·´Â°ÍÀÌ ÈξÀ ¾î·Á¿îÁö¶ó..
¾Æ¹«¸® ¸·¾Æµµ ¸·¾Æµµ ±Ùº»ÀûÀ¸·Î ¾ÈÀüÇÏ´Ù°í ÀÚ½ÅÇϱ⿡´Â Èûµå³×¿ä..

 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.