From my basic understanding of serfdom in the middle ages, serfs, unlike slaves, had a certain degree of legal rights. However, it could be easily countered that these rights were in theory only, and in reality, these rights were ignored and lords could do whatever they wished. Are there any examples where a serf accused their lord of infringing on one these rights and later winning that court case (or medieval equivalent)? What was the punishment?
I can best answer this question in terms of Carolingian France, that is, France around the time of Charlemagne (r. 768-814) and his descendents. Charlemagne is famous for having proclaimed, "There is nothing more than being free or a slave (non est amplius nisi liber et servus)." In actuality, however, things were much more complex, and historians often have a hard time deciding whether a word like servus should be translated as "slave" or "serf." Ultimately it depends upon our assumptions about what a slave or a serf should be, and then we translate accordingly, but to the lawmakers of the Carolingian Empire, it was all the same thing (or at least part of a continuum).
The basic problem for peasant rights is that a peasant's first court of appeal was the local landowner. If that landowner were exploiting his peasants, they'd have no one to turn to. This can quickly go awry if the burdens are too heavy, since peasants under extreme duress have often turned to terrorism (e.g. arson) or revolt. But following Charlemagne, it was also considered the mark of a good ruler to tour the realm and to send out missi (literally messengers, but better understood as legates or royal representatives). These men would check in that all was going according to custom, and they'd refer any major violations to the king himself. It would take a stouthearted or a desperate peasant to raise his appeal to such a dangerous and politically charged court.
This of course raises a second problem. If a peasant wanted to appeal to a missus, he needed to wait for one to be sent. After Charlemagne died, his son Louis the Pious (r. 814-840) held the throne with moderate success, often fighting the rebellions of his own three sons (as well as Charlemagne's illegitimate son Pippin the Hunchback). In subsequent generations, viking and Moorish attacks further destabilized the already fragmenting empire. It's hard to say how often missi beat the bounds of the kingdoms during this period, but it was probably fairly irregular.
To bring out an example of what the kingdom looked like when missi were sent out to administer justice, Louis the Pious had a biographer who gives us an idea:
When they went out, they found an innumerable multitude of the oppressed, either from the appropriation of their patrimonies or from the plundering of their freedom. Unjust ministers, counts, and officeholders were enforcing these things through evil devices. The aforementioned prince ordered destroyed all such acts, which had been impiously done by the hands of wicked ministers in the days of his father. He returned patrimonies to the oppressed, absolved those unjustly reduced to servitude, and he ordered to make charters for all and with his own hand confirmed these with his signature. Doing these things took a long time indeed! (Thegan, ch. 13)
So from this it sounds like peasant serfs were subject to having their patrimony (inherited land and property) seized by their landlords and being forced to work for their lord, thus being effectively reduced to slavery. When a ruler wanted to assert his authority over the land, he'd send out missi who would somehow rectify this situation and restore land, property, and rights. The biographer Thegan doesn't indicate any punishment for the oppressors, other than the mandate to restore what they had taken. So how long peasants retained these things after the missi headed back to court remains uncertain.