A couple of years ago, among the trove of documents released by Edward Snowden, there was information about a "man-on-the-side" attack called Quantum Insert.
The way it works is that the attacker listens in to the Internet traffic from the target organization and when an employee accesses a particular webpage, the attacker steps in and serves up a fake version of that page before the real page has time to respond.
That fake page could collect login information, or it could serve up a drive-by malware download -- and leave the targeted employee completely unaware that anything had gone wrong.
This technique was reportedly used successfully by the NSA and Britain's GCHQ intelligence service against OPEC and against Belgian telecommunications company Belgacom.
Now security company Fox-IT, based in the The Netherlands, has come up with a way of protecting enterprises against the Quantum Insert attack.
"We wanted a better understanding of what Quantum Insert is," said Joost Bijl, the company's product manager. "We run monitoring services for our customers, and wanted to detect if they were victims of Quantum Insert."
Fox-IT built a controlled environment and ran Quantum Insert attacks against it.
"Then we looked at the characteristics of network traffic to see if you could detect it -- and you could -- and we shared those characteristics on our blog for everyone to use," Bijl said.
How Quantum Insert works
In order to use the Quantum Insert method, the attacker has to be close enough to the target to listen in to their network traffic.
For example, they could be at the target's Internet service provider. Or they could be inside the network already, looking to move in a lateral direction.
Quantum Insert is a tool used by advanced persistent threat groups, like government-sponsored organizations or extremely focused criminals targeting one specific enterprise.
Governments, of course, have an edge in that they have an easier time getting access to the network traffic that passes through their country.
So this isn't a method that run-of-the-mill cybercriminals would use, say, to target a large number of people.
"It's not very scalable," Bijl said. "You need to have fast access to the network traffic of the victim. The attacker really has to go to great lengths."
Then the attacker waits for someone to visit a page known to be popular with target employees. According to Snowden's leaks, LinkedIn and Slashdot have been used in the past.
After the target sends out the request for the page, the attacker responds faster than the real site, with a page designed to fool the victim's browser into accepting it as a valid response to its request.
"You insert a packet with the same identification," said Bijl. "There's no way to distinguish it from the real answer as far as the browser is concerned."
Bijl added that communications also have to be in the clear. Encrypted traffic is safe.
And content delivery networks can improve the delivery speeds of legitimate content to the point where it's difficult for the Quantum Insert packet to get to the victim first.
How to detect a Quantum Insert attack
According to Fox-IT, spotting a Quantum Insert attack involves looking for duplicate HTTP response packets that are carrying different contents.
Depending on whether the attacker or the real website won the race to the victim, either the first or the second of the duplicate packets will be the fake one.
Fox-IT has published the code for detecting Quantum Insert and released it on github.