Saturday, October 2, 2010

A Web Developer's Approach to Bedbugs

I hate bugs. It used to be that if I became aware of a problem or vulnerability in the software I was responsible for, or if I noticed something in the application I didn't understand, I wouldn't be able to sleep until the culprit was isolated and squashed. The thought of users encountering a known bug gave me an terrible feeling, and the thought that a hacker on the other side of the globe might be exploiting my system was my worst nightmare.

In its second year of operation, my previous business had two of its servers hacked into. In retrospect, it was a good thing to happen to us. Our customers never noticed the problem, but we got security religion real fast. We became meticulous in patch application, kept our servers clean as a whistle, and monitored the logs regularly. Our servers stayed up for the next 7 years through terrorist attacks of 9/11 and the blackout of '03.

When you do web development and service deployment, you quickly learn that any device open to the internet is being constantly probed for vulnerabilities. You become familiar with all the ways your server is listening for connections and the sort of threats that are out there. You EXPECT that sooner or later, any vulnerability will find attackers, even if an attack would be completely pointless. It's as if bank robbers went door-to-door breaking and entering, just in case your house happened to be a bank.

Consider spam. Spammers don't care that you're an English speaker with no interest in penile implants. They'll still send you emails about them in Greek. They'll even do it with every submit button you put on the web, and they'll leave inane comments on your baby blog. If there's habitat that can support spam, spam will somehow evolve to fill that habitat.

Bedbugs are exactly the same.

When I opened my eyes one morning this summer to the sight of a flat brown bug crawling on my pillow, I didn't freak out- I applied lessons I had learned doing web development and deployment. But I had a lot to learn about bedbugs.

If you've been at all sentient this summer you will have read one or more news articles about the bug that is devouring New York City. I've read all these articles and they're mostly useless. The web was more informative, but less so than you might think. It takes at most 2 Google searches to find useful information almost any web security threat based on its attack vector, but search for bedbug information, and most of what you get are people trying to sell you ineffective solutions to your bedbug problem. Some mainstream media outlets illustrated their bed bug article with a picture of a shield bug. Thank goodness for Wikipedia! Their photos allowed me to identify my bug as a genuine adult bedbug.

Who's afraid of a little brown bug? There's never just one bug. I learned that bedbugs are extremely good at hiding, but you can detect their presence by things they leave around: bites marks in twos or threes, a few mm apart, and little balls of excrement that leave smeary black spots near their hiding places. The bites I had been wondering about, but the bedbug feces I hadn't noticed. Examination of my bed turned up some black spots on the fabric holding the slats together, and I was hot on the trail. I disassembled the bed and found a bunch of bed bugs in a the recessed holes of two of the screw heads holding the bed together. To date, I've found about 30 bugs; I keep them in a double zip-lock plastic bag, the better to study them. Am I a nerd or what?

At a certain point in dealing with bedbugs, paranoia sets in. They are so clever in their ability to hide, you begin to assume they are everywhere. And then you start feeling bugs crawling over you at night. One very useful fact helped me deal with this. It turns out that bedbugs have evolved the ability to crawl on your skin so that you can't feel it. If you feel something crawling on your skin, you can be pretty sure it's not a bedbug. Unless its a bedbug who's just tanked up and is heavy with a load of your blood, and then it's too late. Take a look at the long feet the big bedbug in my picture has- they're designed for stealthy crawling.

By the way, the pictures are taken with a cheap USB microscope that I got on Amazon. Best nerd toy ever! Works with Photobooth on my MacBook Pro. Hey, Christmas isn't that far off!

The USB microscope allowed me to confirm that the tiny things crawling around my kid's beds weren't bedbugs. In my paranoia, I started using an LED flashlight to highlight dust on the floor, and noticed that some of the dust was crawling around. I'm pretty sure these crawling bits of dust are "booklice". Booklice aren't really lice, they're tiny insects also called psocids. Booklice feed on mold that grows on damp plaster (yep, we got that) and glue such as found on book bindings. (Another advantage of ebooks!)

Bed bugs are quite hardy. They last at least a month in my plastic zip-lock bag, and they are resistant to pesticides. DDT resistant strains were observed even in the 1950's

I'm currently living in an apartment while our house is being renovated. When we move back in, we'll be very careful to take only items that we're sure can be trusted. It will be just like rebuilding a hacked computer system. You have to start with something you know for sure is clean, something you can trust, because a otherwise you can't rule out a rootkit. I'm now careful to clean out my vacuum cleaner after every use, and I stow it in a giant zip-lock bag.

For now, though, my study of bed bugs has led me to the conclusion that getting rid of the bugs is just a first step. If you have a server that gets hacked, it does you no good to rebuild the system unless you identify the weakness your attacker exploited. If you don't, the attack will happen again, and you'll be back where you started from. Same with bedbugs. So I've started thinking of my bedroom and its maintenance as a system for sleeping that, for the foreseeable future, will be under continual attack from parasitic blood sucking invaders. Knowledge of the invader's life cycle should help me to design maintainable defenses against the attack.

Most of the news media have focused attention on how to avoid "getting" bedbugs, as if they're a disease. But given how difficult it is for a layperson to detect a bedbug infestation, my guess is that for most people, low-level exposure to bedbugs will be almost unavoidable. Even if you stop sitting in the comfy couches at Starbucks, hanging out in the library, and watching movies in dark theaters, you won't avoid some amount of bedbug exposure.

Think of bedbugs the same way you think of computer viruses. A surefire way to avoid them is to stop using the internet and email, but that's not what most of us do. We deal with computer viruses and similar attacks by avoiding risky behavior and vulnerable software, and by keeping our systems clean and uncluttered. Or don't, as the case may be.

What are the measures that will keep the bedbugs from biting? Some knowledge of the bedbug's life-cycle can provide some insight into our sleeping system's vulnerabilities.

Let's start with the adult bedbug. It feeds at night, and after a full meal, it's sluggish and easy to catch (and to smush into a bloodstain on your sheet or wall). It can go weeks without a meal in its hiding place, and lays eggs where they can hatch and find a meal. The newborn bedbug nymph locates a host the same way a mosquito does- sensing heat and CO2. Nymphs are hard to see, almost transparent, until they have a drink. Then they find a dark place to hide when the sun comes up. The bedbug grows through six stages of development, shedding a skin at each stage.

The ideal habitat for a bedbug is a dark hiding place with an easy commute to dinner. In retrospect, the flaw in my sleeping system was that it provided plenty of idyllic bedbug habitat. I have a platform bed that has a closed space under the bed slats. You can't clean under the bed without removing the mattress and unscrewing the slats. The slats and the frame have all sorts of crevices that must have been a cozy retirement home for great grandpa bedbugs. The highest concentration of resting bedbugs I found was an screw hole a short 18 inch crawl from my shoulder. Other locations reputed to be favorites of bedbugs include electrical outlets, cracks in the floor, and "popcorn" ceilings.

I've eliminated as much of this habitat as possible. The mattress is encased in a mite-proof cover, even though it showed no sighs of infestation. I've filled cracks and I've eliminated clutter from neat my bed. I've put a lot of stuff in sealable plastic bags.

A new weekly cleaning regimen has been instituted for my sleeping system. Every Saturday morning, I run the sheets through the wash and heat the quilt in the dryer. I take apart the bed frame and vacuum, dust, and mop around and under the bed. I snoop around with the flashlight for any signs of bedbugs or their feces. So far this seems to have worked well. I've seen only 2 bedbugs in the last two months.

When we move back into our house, the platform bed frame will get trashed. A new bed will have legs and feet, to better isolate my sleeping area from the floor and to make it easier to clean regularly. When more bedbugs try to hack into my sleeping system, they will not find any cosy hideouts.

And Mom was right. We all need to make our beds every day.

Some resources I found to be useful and/or interesting:

Locating and eliminating bedbugs takes expertise; if you can find a reliable and knowledgeable pest control professional, money you spend on them will not be wasted. But be aware that the explosion of concern about this nuisance created the ideal "habitat" for scam artists and hucksters selling crap.


  1. While I don't want to watch the videos - it's a great article. Thanks!

  2. Recently I've found that bed bugs had infested my bookshelf. I threw most of my textbooks into the microwave so I can continue usage; stopping usage for weeks so I can freeze my books in a freezer or something is just not feasible as I am a student. Do you think bedbugs can infest book bindings? And if so do you think microwave radiation will kill them?

  3. Frances- If the bookshelf is next to your bed, the book spines could provide hiding places. I doubt an adult bedbug could survive a microwave, but maybe an egg could.


Note: Only a member of this blog may post a comment.