Reportedly five Taliban insurgents attacked two guest house in Kabul, Afghanistan popular with foreigners. They used suicide bombs and gunfire to kill at least eighteen people. Presumably that figure includes the dead Taliban.
How hard is it to prevent these kind of attacks? There are two main ways to prevent the attacks from being carried out. First use security to prevent the infiltration of the agents and their equipment into the city. Second use intelligence to identify the plot and those who plan to carry it out so they may be neutralized prior to the actual operation. The first way requires intelligence as well to keep forces on the look out for the agents, their equipment and the methods they use to get into place.
Obviously the level of security in Kabul or the capabilities of the Afghan Government police and military have not reached a point yet where either system will work. These are difficult levels of ability to reach and it will probably take several years as well as a lot of political reconciliation to reach them.