Source of the authorization for punishment
From Textop Wiki
In the original contract, a person has not given away the right to defend himself; so on what contractual basis could the right (authority) to punish arise?
Before I infer anything from this definition, there is a question to be answered of much importance; which is, by what door the right or authority of punishing, in any case, came in. For by that which has been said before, no man is supposed bound by covenant not to resist violence; and consequently it cannot be intended that he gave any right to another to lay violent hands upon his person. In the making of a Commonwealth every man giveth away the right of defending another, but not of defending himself. Also he obligeth himself to assist him that hath the sovereignty in the punishing of another, but of himself not. But to covenant to assist the sovereign in doing hurt to another, unless he that so covenanteth have a right to do it himself, is not to give him a right to punish. It is manifest therefore that the right which the Commonwealth (that is, he or they that represent it) hath to punish is not grounded on any concession or gift of the subjects. …
Hobbes, Lev XXVIII 2
The right or authority to punish comes from the original right in the state of nature to do anything necessary for self-preservation.
...But I have also shown formerly that before the institution of Commonwealth, every man had a right to everything, and to do whatsoever he thought necessary to his own preservation; subduing, hurting, or killing any man in order thereunto. And this is the foundation of that right of punishing which is exercised in every Commonwealth. For the subjects did not give the sovereign that right; but only, in laying down theirs, strengthened him to use his own as he should think fit for the preservation of them all: so that it was not given, but left to him, and to him only; and, excepting the limits set him by natural law, as entire as in the condition of mere nature, and of war of every one against his neighbour.
Hobbes, Lev XXVIII 2