티스토리 뷰

[Windows] ASP 트로이잔 Webshell의 예방 및 문제 해결 방법

 

Source from:[S.S.R.E.T]ServersTeam.Org [F.N.S.T]Fineacer.Org
url:http://www.Serversteam.org/docs/Microsoft_Win_ASP_Webshell_Security.htm

개요:본문에서는 Microsoft 윈도우 계열의 SERVER (IIS5.0,IIS6.0)에서 간단하고 빠르게 ASP 위험성 있는 컨포넌트를 WEB 서버 시스템으로부터 멀리하는 것을 설명 
본문을 읽는 후 자기가 관리하고 있는 서버를 asp 트로이잔, Webshell 권한 상승 및 시스템 보안위협 등으로부터 벗어날 수 있다.

본문:
주의:본문에서 언급된 설정방법 및 설정환경은:Microsoft Windows 2000 Server/Win2003 SERVER | IIS5.0/IIS6.0에 적용함.

1.우선 일반적인 ASP 트로이잔을 살펴보면 Webshell에서 사용한 ASP 컨포넌트는 아래와 같음 
ex) 중국산 webshell인 HY2006

ex) HaiYang webshell의 일부 소스
shellStr="Shell"
applicationStr="Application"
if cmdPath="wscriptShell"

set sa=server.createObject(shellStr&"."&applicationStr)
set streamT=server.createObject("adodb.stream")
set domainObject = GetObject("WinNT://.")

webshell에서는 아래 여러 종류의 ASP컨포넌트를 사용하고 있는 것을 알 수 있다.
① WScript.Shell (classid:72C24DD5-D70A-438B-8A42-98424B88AFB8)
② WScript.Shell.1 (classid:F935DC22-1CF0-11D0-ADB9-00C04FD58A0B)
③ WScript.Network (classid:093FF999-1EA0-4079-9525-9614C3504B74)
④ WScript.Network.1 (classid:093FF999-1EA0-4079-9525-9614C3504B74)
⑤ FileSystem Object (classid:0D43FE01-F093-11CF-8940-00A0C9054228)
⑥ Adodb.stream (classid:{00000566-0000-0010-8000-00AA006D2EA4})
⑦ Shell.applicaiton....

2: 해결방법
① 아래 위험성 있는 ASP 컨포넌트를 삭제 혹은 명칭을 변경한다.
WScript.Shell, WScript.Shell.1, Wscript.Network, Wscript.Network.1, adodb.stream, Shell.application
[시작->실행->Regedit]을 실행하여 레지스토리를 수정
"Ctrl+F"으로 찾기를 실행
순서대로 위에 Wscript.Shell등 컨포넌트의 명칭 혹은 그와 매칭한 ClassID을 입력
해당 명칭을 삭제하거나 변경

되도록이면 명칭 변경을 권장하고 만약 일부 웹 페이지의 ASP프로그램에서 위에 열거한 컨포넌트를 사용했다면, ASP코드작성시 수정 된 컨포넌트의 명칭을 사용하면 됨
만약 ASP프로그램에서 이상의 컨포넌트를 사용하지 않는 다면 삭제 
(삭제 혹은 명칭 변경 후, iisreset으로 IIS재 동작 후 적용)
[주의:Adodb.Stream 컨포넌트는 많은 사이트에서 사용하기 때문에 만약 서버가 Virtual machine 이면 상황에 따라 조치 바람.]

② File System Object (classid:0D43FE01-F093-11CF-8940-00A0C9054228) 보안 문제에 대해 만약 서버에서 FSO를 사용해야 한다면 (일부 Virtual Machine에서는 FSO기능을 사용함), FSO보안 해결방법은 "Microsoft Windows 2000 Server FSO Security risk of solution" 문서를 참고(아래 내용 포함) 사용할 필요 없는 경우 직접 사용 중지

③ 사용 중지 혹은 위험성 있는 컨포넌트를 삭제하는 방법:(방법① 및 방법②를 번거롭다고 생각하는 분은 본 방법을 참고함.)
wscript.shell 오브젝트를 해제하는 방법은 아래와 같음
cmd 모드에서[:regsvr32 /u %windir%\system32\WSHom.Ocx]를 실행
FSO 오브젝트를 cmd 에서 아래 내용을 실행하여 해제한다. [regsvr32.exe /u %windir%\system32\scrrun.dll]
stream 오브젝트의 해제는 cmd에서 [regsvr32 /s /u "C:\Program Files\Common Files\System\ado\msado15.dll" ]를 실행
만약 실행취소를 원한다면 위에 명령에 [/U] 옵션만 제거하면 된다. 즉, 관련 ASP컨포넌트를 재실행 가능하다. 예를 들면, regsvr32.exe %windir%\system32\scrrun.dll

④ Webshell 중에 set domainObject = GetObject("WinNT://.")을 사용하여 서버 프로세스, 서비스 및 사용자 정보 등을 획득하는 것에 대한 예방 방법은 아래와 같음
서비스 중의 Workstation[네트워크 연결 및 통신을 제공함] 즉, Lanmanworkstation 서비스를 중지하면 문제해결 
이렇게 처리하면 Webshell 프로세스를 디스플레이 하는 곳에 공백으로 표시 됨

3 위에 방법1,2에 따라 ASP관련 위험한 컨포넌트에 대해 처리 후, Ajiang asp probe으로 테스트하면, "서버 CPU 상세내역" 및 "서버운영체제"를 찾을 수 없으며 내용은 모두 공백으로 디스플레이 됨 
HaiYang을 사용하여 Wscript.Shell를 테스트 하면, cmd commend line에서 Active를 만들 수 없다는 메시지가 디스플레이 됨 ASP 트로이잔이 서버 시스템에 대한 보안 위협을 완화할 수 있음

본문에서 소개한 내용은 단지 본인이 ASP트로이잔,Webshell에 대한 소견뿐이며 향후 여러분께 어떻게 간단하게 타인 컴퓨터에 net user 와 같은 명령의 실행을 방지하고, 버퍼 오버플로우를 통해 cmdshell 획득을 방지 및 사용자 추가의 방지, NTFS 설정권한에서 터미널 서비스 등록 등에 대한 간단하고도 효과적인 방어방법을 소개할 예정임

저자: 李泊林/LeeBolin
[S.S.R.E.T 服?器安全?究?家小? CTO] Http://www.serversteam.org
[F.N.S.T 情??算机??安全在? 技???] Http://www.fineacer.org


Article Summary: This article will detail, I will introduce how to solve the security threats of the FSO component on the WEB server system setup steps; reading this article in the Microsoft Windows 2000 WebServer (the IIS5.0), you will be able to make your site server systems and data to completely avoid hackers.

Author: Lee Park forest / LeeBolin senior systems engineer, specializing in network security consultant. Has been successful for many domestic large and medium-sized enterprises, ISP service providers to provide complete network security solutions. In particular, specializes in the design of the overall network security solutions, large-scale network engineering, planning, and provide a variety of server series security solutions.

FSO security solutions to the body content:
1, this paper set method and the Environment: Practical on the Microsoft WinNT/2000 Server / Advanced Server, the IIS5.0

2, to ensure that the IIS and the virtual host site uptime, and delete the IIS, such as printer.dav like unsafe application extension mapping (like other topics not in the scope of this article, if you need to know more visible from another one Microsoft Windows 2000 IIS WEB server overall security solution Detailed ")

3, followed by open -----> Start ------> Programs -----> Administrative Tools ------> Computer management -----> Local Users and Groups, and then create some users (assumed to be the: IUSR_0001 to IUSR_0050 50 virtual hosts on your WEB SERVER, if more can be added to some users. head is to use anonymous user access mechanism to ensure that your server can either complete using ASP FSO component function, will not be subject to threats such as ASP Trojan). Where you can decide whether to set a password, in fact, be empty and not be affected much by its own appropriate level of security and the practical requirements.

4, just new the good IUSR_0001 to IUSR_0050 remove the User group permissions, unified them added to the Guests group. (Because of the Microsoft Windows default new user for the Users group automatically, there must be careful not to forget the Users group will IUSR_xxxx driven out of yo ^ _ ^). If for the sake of better security, you can then add a IIS_USERS group will IUSR_XXXX all to join this group in order to facilitate convenient to use in other system security settings.

Management tools for set up the IIS in order to open -----> Start ------> Programs -----> ------> Internet Service Manager -----> Open the IIS Manager your first virtual host interface, and then will open the Site Properties in IIS out of the dialogue interface, click on "Directory Security" in the authentication and access control section, click Edit, and then in the "authentication method "interface" anonymous access "section and then click on" Edit ", the anonymous user account interface will appear, this time you select" Browse "and then select New Guests guests a user in step 3, that is, select the" IUSR_0001 "If you create a new user password is empty by empty input is not empty by the user's password. And then select the following "Allow IIS to control password", then click OK.

[Also note: In order to facilitate management and behind the set directory permissions, the site describe the best and IUSR_XXXX checkmark, such as your above operation is described on the site for Fineacer.com website, then you can describe the site replaced with: Fineacer. com (IUSR_0001). At a glance, is more convenient to manage. ]


6 disk permissions: Make sure you have good C, D, E, F of the type of disk ACLs permissions. (Forthcoming disk Everyone "full control of the right must be removed, this is very dangerous, only it necessary to become) and set the appropriate permissions to your web site virtual directory access permissions, NTFS ACLs. Select the virtual host directory to your site where the Everyone access rights to remove. An increase of only Administrators - Full Control System-complete control. (System is used to Serv-U FTP upload permission to download the Serv-U is the identity of the System to start the service). Then your IUSR_0001 assume here is the root directory of the Web site Fineacer.com (IUSR_0001). And then right again ----> Properties ------> Security, add our IUSR_0001, and give read access, if a single HTML only give read access to, if it is similar to the ASP + the ACESS database also need to add the "write" permission. If the site of the ASP program needs to use the FSO website content online modify, delete and other operations, then in general we will be "complete control" right to IUSR_XXXX.

7, the first virtual host settings finally get ^ _ ^, we put a the Webshell in the site directory, and then browse http://www.fineacer.com/webshell.asp, try, and then the FSO function access to other web directory is not access, let alone edit, and delete the other virtual host the user's page file :) the remaining work is to repeat steps 3, 4, 5, 6, will be set for all sites. With the best of my knowledge, most of the virtual host management system is to use this principle to Except that these steps are written to the virtual host management system program fills.


출처 : http://egloos.zum.com/totoriver/v/3336667

 

ASP 트로이잔 Webshell의 예방 및 문제 해결 방법

Source from:[S.S.R.E.T]ServersTeam.Org [F.N.S.T]Fineacer.Orgurl:http://www.Serversteam.org/docs/Microsoft_Win_ASP_Webshell_Security.htm개요:본문에서는 Microsoft 윈도우 계열의 SERVER (IIS5.0,IIS6.0)에서 간단하고 빠르게 ASP

egloos.zum.com

 

'OS > Windows' 카테고리의 다른 글

[Windows] robocopy [펌]  (0) 2018.04.03
댓글