Ever wonder exactly why cyberespionage attackers can be so difficult to detect? These so-called advanced persistent threat (APT) attackers increasingly are camouflaging their activities by using tools that exist in the targeted host, operating via commonly used network ports, and even hiding their command-and-control (C&C) communications within HTML comments.
"They're hiding in plain sight," says Shawn Bracken, chief scientist at HBGary, who studies these attacks firsthand in forensic investigations. "It really harkens back to their sophistication in being aware of behavioral blocking and analysis [that organizations] are using."
Rather than making any moves that could trigger an alarm or raise suspicion because it's out of the norm, these attackers instead just try to blend in. "The tools they are installing are specifically installed not to run afoul of the IPS [intrusion prevention system]. They use legitimate, published APIs and make a special effort not to do things out of the ordinary."
That means using real systems admin tools resident in the targeted operating system, and increasingly using HTML comments for their C&C. There are at least three APT groups, including the ones behind the Operation Shady RAT campaign, using that technique to conceal their communications. "You can't block [all] websites that contain comments," Bracken says.
Joe Stewart, director of malware research for Dell SecureWorks Counter Threat Unit, says the use of encrypted HTML comments on Web pages has been part of APT-type attacks for some time. "This is a technique which has been used for several years, and security researchers who have been following APT activity, I believe, have been aware of it for several years," Stewart says. "Knowledge of the HTML comments can be used to help detect APT traffic, however, only for the specific malware using specific HTML comments and their respective formats."
It works like this: The attackers exploit a Web server somewhere on the Internet or a social network site, such as a blogging site. The attacker then tucks his encoded instructions as a hidden comment on that website, and the RAT regularly checks the page.
"We've seen two scenarios -- a compromised Web server that a hacker will penetrate into, using SQL injection, for example, and then hide his comments on that server," says Greg Hoglund, CEO of HBGary.
The RAT has a hard-coded DNS name in it to connect to, which is then altered to match the IP address of the infected site. "So the RAT makes the outbound connection and grabs the instructions," he says.
The second scenario is where attackers use a legitimate social media or application site, such as Google BlogSpot, to host their hidden instructions in an HTML comment, Hoglund says. Those instructions are often configuration instructions, such as ordering a machine to connect to a specific machine in the victim's network and leave open a TCP connection. That provides the attacker with an interactive link to the machine, "and he gets command-line access," Hoglund says.
Even the remote access tools are purposely not stealthy: "They don't appear to be armored for anti-forensics," Hoglund says. "They make it look like a normal piece of software."
So if you can find the HMTL comments, you can figure out on which machines the RAT is installed, he says. But there are also likely more RATs in the network, Hoglund says.
HBGary's blog post on APT attackers employing HTML commands is here.
Have a comment on this story? Please click "Add Your Comment" below. If you'd like to contact Dark Reading's editors directly, send us a message.
Kelly Jackson Higgins is the Executive Editor of Dark Reading. She is an award-winning veteran technology and business journalist with more than two decades of experience in reporting and editing for various publications, including Network Computing, Secure Enterprise ... View Full Bio