| A Practical Approach of Stealthy Remote Administration |
This is controlled by another attached device called "Air Gap" which allows specific traffic to pass through, providing a true stealthness. I assume that most of you are not going to use the latter method yet, so I will focus on the first one. A Bit Of IntroductionBy following very simple steps, you will be able to remotely access hosts with a "DENY ALL" firewall policy set or even hosts without an IP address assigned. This technique is based on a tool called SAdoor (http://cmn.listprojects.darklab.org) which is available for Linux , BSD and SunOS. This tool is comprised of two components: SAdoor: a daemon program which listens on an NIC for a set of pre-defined packets. Sash: a client program used to craft these special packets and send them to SAdoor host. Although in certain configuration, it is be possible to use ordinary tools like ping, telnet or netcat to generate such desired packets instead of relying on Sash. Seems interesting enough? Nows lets get into details of how to put things together. The Server SideSAdoor itself is a non-listening daemon, thus requires no listening port. It grabs packets directly from NIC and watches for special key and command packets then executes a pre-defined command (ie: /bin/sh). All command packets are encrypted using a conventional symmetric cipher namely Blowfish. It also has a replay attack protection and other cryptographic features. For more detailed information, please read the documentation at: (http://cmn.listprojects.darklab.org/doc/sadoor.ps) SAdoor has three configuration files as follows: sadoor.conf:
Then, you will have to generate a seed from any random pool on your system. This seed will be used by SAdoor to generate a 448-bit Blowfish key for symmetrically encrypted client/server communications. Most *NIX already have a random device which gathers these entropy sources and can give an acceptable level of pseudo-randomness. For instance, on Linux you could do:
Then it's time to define a set of those special packets we've talked about earlier. sadoor.pkts:
Using the above set of pre-defined packets, SAdoor will first mark any ICMP echo-type 8 (echo request) with icmp sequence = 27, then wait for any occurrence of ICMP echo-type 8 with icmp sequence = 3. Upon completion of two key-packets, SAdoor will now look for a valid command-packet which in this case is specified as ^\any TCP packet with destination host 10.0.0.1 and destination port 6666^]. If a ll these packets are seen by NIC on SAdoor host in the right order within a given timeframe (in this case, it is set to 20 seconds) then it will execute a script /etc/sadoor/ncmd.sh which may contain the following entries: ncmd.sh
The Client (hopefully you)
Obviously, there is no response from the target host. Don't worry, we just need the NIC to see these packets and have them marked by SAdoor. You can check if everything works out by looking at sadoor .log on SAdoor host sadoor.log:
Viola! , You now have successfully executed ncmd.sh script which contain something like:
This means that SSH service is now accessible. Now try to connect to SSH port 22 again:
Please remember that when you are done with your job , bring your SAdoor system back to a stealthy state again (iptables -F && iptables -I INPUT -j DROP or ifconfig eth0 0.0.0.0 arp) Note that: Make sure your key-packets are indistinguishable from "real" traffic. Although, this is more like a security through obscurity because anyone could figure out your key-packets and replay them. The impact of this attack is not that high since it will only bring the interface up temporarily. So, it works at an acceptable level for us. More Advanced StuffAs I have mentioned earlier, SAdoor can watch for certain packets on a promiscuous mode NIC, So it is possible that those key and command packets be directed to other hosts on the same segment where SAdoor can see the them. This will make your SAdoor host completely blind from the network and nearly impossible for anyone to detect. Note that the key and command packets used in this paper are considered simple. You may need to play around with TTL values , IPID , ACK number or even use the application-specific data like (GET /index.html HTTP/1.0) to trigger the command. To achieve higher security, you should always use a Sash client to connect to SAdoor daemon as it provides encrypted and replay-protected communications. Though, you will have to be able to access some data like sash.db, which in some cases you don't. Another thing is that, SAdoor daemon is also available as a kernel module to make the daemon process hidden from users. (currently *BSD). If possible, you could even make it unkillable or unloadable through the use of additional kernel ACL depending on your OS. Having said all these, I hope you find this paper useful in some ways. Nawapong Nakjang has been working in the areas of information security, network security and cryptography for several years. His interests include intrusion detection, honeypots, incident investigation, malicious code analysis, computer forensics and penetration testing. Occasionally, he writes security-related articles.. He plans to pursue his second degree in Information Security and publishes more papers to the security community.
Only registered users can write comments. Powered by AkoComment! |
|||||||||||||