That isn't really true. There are specific rights that you can't give up. You can't, for example, submit to assault except in limited circumstances (e.g. surgery). But, in general, you can contract away all sorts of rights. Lots of contracts require disputes to be settled by arbitration, for example, which forces you to vie up your right to go to court. Such contracts are, in general, valid and enforced.