Welcome to the world of parasitism.
These hornworms are facing the unlucky fate of a slow death. A female braconid wasp lays her eggs in an unsuspecting hornworm. The eggs hatch and the larvae feed on the hornworm from the inside. When the larvae are mature, they chew through the hornworm's skin (yes, I said they CHEW THROUGH it's skin...ewww).
Once the larvae reach the outside, they form these tiny cocoons along the back and sides of the hornworm. This is what you see here in the pictures. By this point, the hornworm is extremely weak, still alive, and continues to act as a host to the pupating wasps. Once the metamorphosis is complete, the wasps will emerge, find mates, and start the process over again with another unsuspecting hornworm.
Although the hornworm can still do damage to the plants while this process takes place, these wasps can significantly reduce the population of these highly destructive garden pests. Like I said, revenge is best served with eggs!