Anti-Overflow Privilege Escalation Solution

Source: Internet
Author: User
Tags echo command
This article will introduce you to the Microsoft series (Win2k win2k3) server, how to easily and quickly solve security threats such as bounce Trojan, overflow, elevation of permissions, and bounce shell attacks. After reading this article, you can protect your server from security threats such as overflow and elevation of permissions.


Today, as hackers frequently attack and system vulnerabilities emerge in an endless stream, as network administrators and system administrators, we have made a lot of effort in server security: for example, install system security patches and perform some regular security configurations in a timely manner. However, it is unlikely that each server will immediately patch the system. Therefore, we need to block intruders from the "security door" through a series of security settings before they are intruded; the following describes the simplest and most effective solution to overflow and local attack permissions that I have been using: (because N has no time to write for a long time)ArticleI have promised you to write this article for you before, but you have never had time to write it to anyone. ^ _ ^, I hope you can read it here ...)

Server Security Settings-anti-Overflow Privilege Escalation solution body:

1. How can we prevent overflow hacker attacks?

① Install patches for system vulnerabilities as much as possible. For example, the system of the Microsoft Windows Server series can enable the automatic update service, then, the server is automatically connected to the Microsoft Update Website for patch updates within a specified period of time. If your server prohibits Internet connections for security reasons, you can use the Microsoft WSUS service to upgrade your server over the Intranet. (For installation and configuration of Microsoft WSUS 2.0, refer to this article:

② Stop all unnecessary system services and applicationsProgramTo minimize the attack coefficient of the server. For example, MSDTC overflows a few days ago, causing many servers to crash. In fact, if a web server does not use the MSDTC service at all, you can stop the MSDTC Service so that MSDTC Overflow does not pose any threat to your server.

③ Enable TCP/IP port filtering: only common TCP ports such as 21, 80, 25, 110, and 3389 are opened. If the security requirement is higher, you can disable the UDP port, of course, if this problem occurs, it is inconvenient to connect to the external server. We recommend that you use IPsec to block UDP. In protocol filtering, "only allow" TCP protocol (Protocol Number: 6), UDP protocol (Protocol Number: 17), and RDP protocol (Protocol Number: 27; other useless items are not open.

④ Enable the IPsec Policy: Perform Security Authentication for the server connection and add double insurance to the server. As mentioned in ③, some dangerous end products can be banned here, such: 135 145 139 445 as well as UDP external connections, as well as the encryption of passthrough and communication with only trusted IP addresses or networks. (Note: in fact, the anti-bounce trojan uses ipsec to simply prohibit external access from UDP or non-commonly used TCP ports. The application of IPSec will not be continued here, you can go to server security to discuss search "IPSEC" and there will be n more information about IPSec applications ..) (the game blade is on the edge of the Technical Ghost God to create a server security myth! Pioneer in the Internet revolution! Server Security discussion area [s.s. d. A]

⑤ Delete, move, rename, or use the access control table column access control lists (ACLs) to control key system files, commands, and folders:

The hacker often comes to the shellside, and uses all the features such as net.exe net1.exe ipconfig.exe user.exe query.exe regedit.exe regsvr32.exe to further control the server, such as adding an account, cloning an administrator, etc. Here we can delete or rename these command programs. (Note: When deleting or renaming a file, stop the File Replication Service (FR) or delete or rename the corresponding file under % WINDIR %/system32/dllcache .)

2.alternatively, you can move these. EXE files to the specified folder, which makes it easier for the Administrator to use ^ 0 ^

3. Access control table column ACLs control:

Find maid 32.exe net.exe net1.exe ipconfig.exe tftp.exe ftp.exe user.exe reg.exe regedit.exe regedt32.exe regsvr32.exe under % WINDIR %/system32.

These files commonly used by hackers are defined in "properties" → "security" for the ACLs users they access. For example, they are only authorized to access the administrator, if you need to prevent overflow attacks and illegal exploitation of these files after the overflow is successful, you only need to deny access to the system users in ACLs. (What if you are a Bt character? ^_^ then let's drop all users !, Here we will ask all types of visitors to handle the issue based on their own facts ).

4.if you think guiis too annoying, you can also use the system command cacls.exeto edit and modify the ACLs of the. exe file, or write it as a. bat batch file to execute and modify the commands. (For details, see cacls /? Help, because there are too many commands here, I will not list them one by one for Batch ProcessingCodeThank you !!)

5. it is also necessary to set the Security ACLs for disks such as C, D, E, and F. In addition, especially for Win2k, for folders such as WINNT, winnt/system, document and setting.

6. Modify the registry and disable the command interpreter: (if you think the method ⑤ is too cumbersome, try the following permanent method to disable cmd running)

By modifying the registration table, you can disable the use of the command interpreter (cmd.exe) and run the batch processing file (. BAT file ). Specific Method: Create a New Double Byte (REG_DWORD) and execute HKEY_CURRENT_USER/software/policies/Microsoft/Windows/system/disablecmd. Modify the value to 1, command interpreters and batch files cannot be run. If the value is changed to 2, the command interpreter is disabled. If the value is changed to 0, the CMS command interpreter is enabled. If you are making too much effort, save the following code as the *. reg file and import it.

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER/software/policies/Microsoft/Windows/system]

"Disablecmd" = DWORD: 00000001

7. Downgrade some system services that run with the system permission. (For example, replace a series of services or applications running with system permissions, such as Serv-U, IMail, IIS, PHP, MSSQL, and MySQL, with the permissions of other administrators or even users, this will be much safer... however, the premise is that you need to know more about these basic running statuses and calling APIs .)

In fact, in addition to using the preceding methods to prevent overflow attacks such as overflow, there are also n methods: for example, using group policies for restrictions, the write protection filtering program uses DLL to load windows to related shell and dynamic link programs. Of course, writing code to verify encryption requires a deep Win32 programming Foundation and a lot of research on shellcode. This article only discusses simple solutions, so other methods are not described here...

2. How can we further intrude into the system after preventing hacker overflow and obtaining shell?

① After completing the above work in step 1, it basically prevents the hacker from getting shell after overflow; because even if overflow overflows successfully, however, it gets stuck when calling mongoshell and external connections. (Why, because: 1.once the program is out of control, it can be called again. We have banned system1_cmd.exe. 2. The external IP address cannot be connected to the reverse IP address after the overflow. Therefore, it is difficult to rebound the shell through the system permission ...)

② Of course, there is no absolute security in the world. Suppose that the intruders have obtained our shell, what should they do? Generally, after obtaining the shell, intruders can further control the server by transmitting files through TFTP, FTP, and vbs using system commands and accounts. Here we use the above method to limit the command. Intruders cannot transmit files through TFTP or FTP, but they can still write the batch through ECHO, use batchcompute scripts such as BAT, vbs, and VBA to download files from the web and modify files of other disks. Therefore, we need to restrict the echo command and the permission to write and modify files on other disks. Disable or restrict the running right of the system by using vbs/VBA scripts and XMLHTTP components. In this way, the shell cannot be used to delete files on the server and control the process. In addition, the Local Elevation of Privilege rebounded and shell won't be used.

Note: the security of other servers and systems is a general concept. It is possible that your website or even the server may be compromised by a small amount of negligence. Therefore, security policies must take the road to preventing problems before they happen. You cannot be careless in any small part of the world. Today's security tips on preventing overflow are introduced here... for other server security configuration experiences, see the next article :-) (Note: Due to my lack of learning skills, it is inevitable to make mistakes in this article. Please forgive me! It is intended to inspire others. If you have a better solution, please do not forget to post ^ 0 ^ on the Forum. Thank you !)

Copyright of this article: The copyright of this article is shared by the [server security discussion board] and [Love Story online]. You can reprint it at will, but be sure to keep the integrity and author information of this article; please cherish others' knowledge and copyrights!

Author: Li Bolin/leebolin senior system engineer, professional network security consultant. ISP service providers have successfully provided complete network security solutions for many large and medium-sized enterprises in China. He is particularly good at the design of the overall network security solution, the planning of large-scale network engineering, and the provision of a complete series of server security solutions. [S.s. d. server a security discussion area] http: // [F. n. s.t online] http: // E-mail: leebolin # QQ: 24460394 if you have any suggestions or questions about this article, you can send a letter or QQ online to communicate with the author; or go to the server security forum to discuss with the author!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.