Eight weeks after Ukraine’s new government and pro-Russian separatists in the country’s east agreed to a cease-fire, the war continues to simmer. It is fought with guns and rockets on the ground and with warnings and sanctions at the negotiating table. But, nearly invisibly, the war is also being waged along a third dimension: intelligence. On that front, both Ukraine and the West are scrambling to counter Russia’s vast advantage.

For Kiev’s new leaders, still struggling to set their country right after popular protests toppled the pro-Russian government of President Viktor Yanukovych last year, accurate and reliable information about the rebels in the east is critical. But obtaining intelligence about the aims, intentions, and capabilities of the rebels—let alone those of the Russian government that supports them—is nearly impossible. As Kiev attempts to react to Russian and rebel initiatives, both military and political, it often has only a faint idea of whether they represent serious moves or feints and what endgame they pursue. Even the numbers of rebel troops and the weapons they’ve acquired from Russia are frequently little more than guesswork. Meanwhile, Moscow enjoys a significant upper hand over Kiev when it comes to intelligence—the Ukrainian communications and command structures are thoroughly permeated by Russian agents—and is using this advantage to further tilt the playing field in its favor.

Time is working against Ukraine. To reverse the trend, Kiev must not only ramp up its intelligence and counterintelligence efforts but do so while radically reforming the Ukrainian security apparatus. Relying on Western assistance is of little help: the West, too, is short on reliable sources in eastern Ukraine and outmatched by Russia’s prior preparation. Ukraine’s ongoing political transition and last weekend’s parliamentary elections give its government a window of opportunity in which to reclaim control over this key instrument of security policy. Otherwise, Ukrainian credibility and sovereignty will both continue to be under question.

MOSCOW'S BACKYARD

Four factors have given Russia a head start in the ongoing intelligence war. First, Russia has long been preparing for the kind of conflict underway in Ukraine—one that combines espionage with firepower, economic pressure, information warfare, and political maneuvering. The Russian intelligence services use all these tools effortlessly—a skill that they inherited from their Soviet predecessors and further refined for today’s world, in which influence is as much about economic leverage and the ability to spin the story as about actual facts on the ground. It is telling that even the head of the Russian army, General Valery Gerasimov, admitted last year that “nonmilitary means” have become indispensable to Russia and sometimes even exceed traditional firepower in importance.

Second, Russian intelligence services have for decades maintained a firm foothold in Ukraine—a presence with roots in Soviet history when the Ukrainian security apparatus was simply the local branch of the KGB. Russian operatives, most commonly working for the Russian Federal Security Service (FSB), the KGB’s successor, permeate Ukrainian police and intelligence agencies. Russia sympathizers and agents, many of whom belong to the GRU, Russia's resurgent military intelligence agency, fill the Ukrainian army ranks. Equipped with an array of tools—from embedded spies to communications intercepts—the GRU is tasked with locating Ukrainian military units, uncovering their plans, and conducting paramilitary operations against them. The Russian Foreign Intelligence Service and Ministry of Internal Affairs, likewise, have also built extensive networks in the country. In particular, the Ministry of Internal Affairs’ long-standing relationship with its local counterpart, the Ukrainian Ministry of Internal Affairs, has allowed the agency to easily identify Ukrainian counterparts amenable to FSB recruitment.

Third, Russian intelligence forces maintain a significant ground presence—both open and covert—near the Ukrainian border. They have taken full advantage of the free flow of people between the two countries, which Ukraine has so far done little to stem. For example, there is evidence that the Russian intelligence services have been interviewing Ukrainian refugees crossing into Russia, under the pretext of gathering data on war crimes. The interview subjects could be providing valuable information about Ukrainian government forces battling the rebellion, from the locations of their encampments to the tactics they use.

And finally, Moscow has had the first-mover’s advantage since the start of the conflict. Its superior intelligence capabilities have meant that it can afford to keep its options open, changing its strategy and objectives week by week. In fact, Moscow’s only clear objective has been to prevent Kiev from suppressing the rebels—a task in which it has proved quite successful.

TRUST NO ONE

Kiev’s response to Moscow’s challenge has been remarkably flat-footed. The government has been unable to trust its own military, police, and security services, rightfully suspecting them of being riddled with pro-Moscow infiltrators. Ukrainian officials probably overestimated the actual degree of Russian penetration, but their lack of confidence in their own regular forces forced them to rely more on informal citizen militias early on in the campaign. The fact that some of those militias harbored anti-Russian, ultra-right views only fueled the conflict.

Kiev has since been working to cull the forces’ ranks, but it is fighting an uphill battle. Ironically, its weakest link is the Security Service of Ukraine (SBU)—the very organization tasked with hunting foreign moles and supporting the anti-insurgency campaign in the east. As of early this year, as many as 30 percent of its personnel might have been Russian agents, according one prominent Ukrainian security expert. Under the Yanukovych regime, deep Russian involvement in the SBU had been an open secret. The organization’s former deputy head, for example, admitted in 2010 that not only were there Russian agents among the SBU’s ranks, but the organization had an official agreement with the FSB, spelled out in a 2010 cooperation protocol, that allowed Moscow to recruit agents from within the Ukrainian government. In December 2013, a team of 30 FSB officers took part in SBU training exercises and met with its director, who has since fled to Russia along with two former deputies and two former department chiefs.

The SBU’s new head, Valentyn Nalyvaichenko, inherited an agency whose personnel was untrustworthy and whose secrets had already been plundered. He attested in recent interviews that, on the eve of Yanukovych’s ouster, Russian agents ripped apart the Ukrainian intelligence treasury, removing “files, archives, everything that forms a basis for a professional intelligence service.” Since then, the agency has seen massive staff turnover, as new leaders rushed to replace old cadres with loyal recruits. And the firings are set to continue. In mid-October, Kiev introduced a new law, aimed at weeding out Soviet-era holdouts at all levels of government, including the security apparatus, of which some 20 percent had either worked for the Soviet KGB or studied at its training academy, according to Nalyvaichenko.

This cleanup comes at a heavy cost to experience and professionalism. As one U.S. intelligence officer put it to me, “Some of these [new recruits] are still kids. They will season up nicely, but they are having to do jobs they’re not really trained or experienced enough for.” And it could take months or even years to fully rebuild the SBU as a reliable service. Inevitably, some talent and expertise will be lost for nothing; not every former KGB trainee ended up becoming a Russian mole. And, of the officers who remain, some who appear impeccably loyal and have no ties to Moscow could still fall to Russian bribery or blackmail. Although Russia’s grip on the SBU has grown weaker since the new government took office, it has certainly not disappeared.

HOME-FIELD ADVANTAGE

Kiev is not the only capital scrambling to counter Moscow’s advantage. Strategists across Europe and the United States are having similar trouble adapting to the new hybrid war in Ukraine’s east. Before hostilities erupted this past spring, the West had not bothered much with intelligence in Ukraine, focusing its resources instead on Asia, the Middle East, and Russia. This oversight has cost Ukraine’s Western allies valuable time at the start of the conflict. As a result, they lack agents on the ground and have little opportunity to safely insert them now. And their analytic capacity back home to interpret and assess what little intelligence data can be gleaned is often minimal.

The tools that the West did have at its disposal proved woefully inadequate. For example, although the West, and the United States in particular, does have far superior technology—such as satellite surveillance and electronic eavesdropping—Russia still managed to surprise them with its takeover of Crimea. That’s because Moscow had taken steps to minimize its vulnerabilities, including keeping its forces dispersed and undercover until they were ready for deployment. The Kremlin also misled observers by staging military exercises that dulled their suspicions about its true intent and relayed crucial orders by courier or land line rather than the more vulnerable broadcast signals.

Once the conflict moved into eastern Ukraine, the West found itself even further behind. The challenge of embedding Western agents in a region now controlled by the separatists proved very difficult, since any such sources would not be able to cultivate “legends,” or cover identities. As one British intelligence official told me, “this is not the kind of environment in which you can just drop in an agent without a solid cover—and building that kind of cover takes time.” Moreover, the region has no foreign embassies to shelter the agents or provide a front for their work.

Further, the separatist authorities are unpredictable. Any spy would risk beatings, imprisonment, or worse at the hands of local insurgents, who are often little more than thugs and who make their own rules. The task, in a word, is nothing like spying on a full-fledged country, with clear hierarchies and policies. Even determining whether rebel leaders are acting on their own or as agents of Moscow can be maddeningly difficult, since the answer often lies somewhere in between.

Without such knowledge, however, Western policy will remain as indecisive as it is today. Meanwhile, Moscow is using its intelligence advantages to preserve a bloody and miserable stalemate that it hopes will force the Ukrainian President Petro Poroshenko to offer major concessions to the separatists—the kind of terms that would allow Putin to claim victory without formally entering the war. Even short of a full-fledged peace settlement, however, Moscow will win as long as Kiev loses.