Generally, if you were to roll the shroud back, remove the cable, squeeze the lever all the way, and then look, you would see that, with the lever squeezed, there is a sort of hole in the lever arm exposed where the barrel-shaped cable end fits. You need several inches of slack in the cable to get it into/out of that hole.
**On re-reading the question:** It sounds as if your complaint may be that the ferrule on the end of the cable **housing** has slipped out of the hole on the end of the brake lever assembly (vs the cable inside coming loose from the moving lever). If this is the case, that housing is held in place by "habit" -- there's no crimp or anything that holds it there, **except that** tension from the brake cable keeps it in place. If the tension is gone, either because the cable has been loosened at the other end, or because the cable has developed too much friction inside, then the housing end will be pushed from its resting point as you operate the lever.