What, exactly, was the sin that was perpetrated against Noach, and who did it?
Ramban (to 9:18) and Targum Onkelus: Cham saw his father unclothed, and, instead of covering him, he gleefully went and told 1 his brothers in the presence of others. 2
Rashi #1 and Targum Yonasan: When Cham saw his father unclothed, some say that he castrated him.
Rashi #2: Others say that he raped him. 3
Seforno: It was Kena'an 4 who castrated his grandfather; Cham's sin consisted of seeing what his son Kena'an had done and remaining silent. 5
Rosh (to 9:25): Cham saw Noach unclothed, and said so in the market. Kena'an heard and raped him. 6
Hadar Zekenim: He was cursed to be a slave due to sinning with his eyes and teeth. Therefore, if a master destroys the eye or tooth of his Kena'ani slave, the slave goes free (Shemos 21: 26-27).
He derives this from the word "ba'Chutz."
Rosh (to 9:25): This in addition to the former deed (Sanhedrin 70a).
When the Torah writes later that "Noach saw what his youngest son had done," it is referring to his youngest grandson (since "one tends to call one's grandsons, sons" (Yevamos 62b)).
And when the Torah writes that Cham saw his father's "Ervah," it means his disgrace, which the Pasuk sometimes refers to as "Ervah."
Ibn Ezra is also cited by Ramban (to 9:18) as giving this approach..
How are these two possibilities (as to Cham's deed) derived from the verses?
Gur Aryeh: See Sanhedrin 70a. All agree that Cham castrated him (and prevented his father from having a fourth son); this is why Noach cursed Kena'an, Cham's fourth son. 1 One opinion says that he committed sodomy as well, as derived from a Gezeirah Shavah from the act of Shechem (34:2).
Rashi on our verse presents an alternate reason: it was Kena'an who initially saw Noach's disgrace and told his father.
How could Cham have done such a despicable deed?
Maharal #1 (Be'er ha'Golah, Be'er 5, Ch. 11): We learn how debased and steeped in immorality Cham was, from the Torah's condemnation of his descendants, the nations of Mitzrayim and Kena'an (Vayikra 18:3). Cham also did not want Noach to personally rebuild the world, because he wanted to take his father's place. Because he prevented further blessing in the world, he deserved to be cursed.
Maharal #2 (Be'er ha'Golah ibid.): The verse can be taken in the literal sense. Cham's tendency towards immorality was so intense that his mere seeing amounted to an act of incest (illicit relations are termed "seeing;" see Vayikra 20:17). Also, his mere seeing was what rendered Noach impotent, because the reproductive organs derive their energy by remaining hidden, and indecently viewing them takes away their potency (see Sanhedrin 92a).
QUESTIONS ON RASHI
Rashi writes: "And Cham saw... - some say castration; some say sodomy." Why doesn't Rashi use the literal meaning?
Gur Aryeh: When Noach awoke, "he knew what his insignificant child had done to him," while mere seeing is not an action. 1
However, refer to 9:22:1.3:2.