1. The Shadow breeds slowly.
Ten tons isn't a lot when you think on a planetary scale. That's really just enough to scare the pants off a major city. In the beginning, people will discover seemingly random killings at night, or in dark corners of subways and large building halls. Closets are NOT your friend. But like any good horror movie, the threat needs to grow just a bit slowly — to make everybody really pee their pants. So, your insect-machines are quick killers, but slow replicators. It might take months or even a couple of years for this to become a planet-wide panic.
2. The Shadow needs time to reflect on the morality of what they did
Yes, they kill quickly! And they don't need anything from the humans they kill other than to lie still. But expecting the little monsters to be ready to kill again after offing an entire human being is asking a bit much! We're talking sleepy-puppy-syndrome here. Those happy bugs, once they've killed, need a day or two to recharge — during which time they're moving, which means you can't trust the next shadow, either! (Yes, as machines they don't need much energy... but that's ignoring the scale of what's happening. They don't have a lot of storage capacity, either. In other words, it takes a lot of power to inject a human with nerve gas, and to replicate that nerve gas... time... it takes time....)
3. Flame throwers are cheap
Once humanity starts to get a grip on the problem (don't trust the shadows! Don't blink! Don't go out in the night! Night lights on sale at your local hardware store now! And toilet paper! Don't forget the toilet paper!) they realize that the easiest way to destroy the machines in three-dimensions is a flame thrower. If they were normal bugs pesticides would work just fine — but they're not! And nothing is more satisfying than lighting up the night while cooking your most dread enemy! The only substantial problem is there are a LOT of shadows and not everything is conveniently made out of concrete. (It's OK honey, you don't need a blanket to sleep. Why's the mattress on the floor? Oh! Don't worry about that! Everybody's doing it!)
4. Which brings us to powerful magnets
The biggest problem with machines is that they suffer for magnetism. The smaller they are, the harder it is to protect them from it. Some lovely lady's walking down the street one day and happens to notice that the machines are swarming all around her, but not next to the Women's Pure Copper Healing Bracelet, $22.01 from Amazon if you Buy Now!. With her dying breath she screams out, "they hate magne...!" Suddenly everybody is wearing Neodymium magnets sewn into their clothing. But they can't use their cell phones anymore.
5. Until Bill Gates funds the development of anti-nanite nanites
And all of that gave some clever monkey enough time to both develop an anti-nanite nanite (lovingly called Warhammers! until Disney threatened a trademark infringement suit) AND pitch Bill Gates to fund their development. It's taking time to rid the planet of the monstrous machines, but it's working! The annual death rate is down to only 7% of the planetary population!
Post Script: There are some practical issues you can consider for controlling the might of your infernal machines!
(a) No shadow is completely dark, which is good for you, because the amount of light in a shadow is a convenient variable you, the author, and twiddle to balance the Terror of the Night with survivability. If you think the insects are too overpowered, lower the light level needed to occupy a shadow.
(b) As I sit here typing away I look around myself and realize that there are appreciable shadows EVERYWHERE. Not the least of which are in the space below my personal bulk. There are shadows in the creases of the plastic packaging around all the equipment. There are shadows INSIDE the equipment. Beneath books on my desk... they're everywhere. That works to your advantage, too. Your machines may have some processing power, but how do you judge an effective hiding place? That's another variable you can twiddle. If they're too overpowered, turn that knob so they hide in more and more useless shadows. Think about it, what are the odds of anyone opening up their laptop? It's just not common. But if enough of your bugs hide inside of laptops (shadows... they're everywhere) then there aren't a lot in areas that are more problematic... like under my desk where my legs are.
(c) Those little honkers will be susceptible to electromagnetic emissions (radiation-hardened insect-sized machines? Might as well admit that they're overpowered now and get it over with, right?). Humanity has massive variations in those emissions. In technology-saturated countries EM emissions are everywhere. So, here's a third dial you can twiddle — making them more or less susceptible to EM. (Heaven help places that aren't saturated...)