The incident occurred at Franklin Regional High School as students were arriving for class at 7:13 a.m. ET.
According to authorities, Hribal armed with two, 8-inch stainless steel knives went on a mass stabbing spree before being tackled by the assistant principal.
Hribal was denied bail and is being held in a juvenile detention center in Westmoreland County. He is charged as an adult on four counts of attempted criminal homicide, 21 counts of aggravated assault and one count of possession of weapon on school property.
His preliminary hearing is set for April 30.
Michael Float, an 18-year-old senior, said he had just gotten to school when he saw "blood all over the floor" and smeared on the wall near the main entrance. Then he saw a wounded student.
"He had his shirt pulled up and he was screaming, 'Help! Help!'" Float said. "He had a stab wound right at the top right of his stomach, blood pouring down."
A 911 call was made and a fire alarm was activated requesting medical assistance.
Alyssa Finch told ABC News that a fellow student pulled the fire alarm during the stabbing "because he knew what was happening ... and he wanted the people to get out."
Westmoreland County emergency management spokesman Dan Stevens says four students were believed to be seriously injured.
He added that not all of the 24 injured were cut by the knife, but most were. All of the victims were expected to survive. Several helicopters were seen flying people from the scene to area hospitals.
Seven teens and one adult were listed in serious condition at Forbes Hospital, West Penn Allegheny Health System spokeswoman Jennifer Davis said. They ranged in age from 15 to 60.
Among the victims was a security guard stabbed in the stomach, according to Thomas Seefeld, the police chief in Murrysville.
Dr. Chris Kaufman, the trauma director at Forbes Regional Medical Center, says two victims were in the operating room and one was awaiting surgery. All three were stabbed in the torso, abdomen, chest or back and listed in critical condition.
A ninth victim, a 15-year-old girl, was in good condition at Allegheny Hospital, Davis said.
Twelve of the victims were sent to four hospitals in the University of Pittsburgh Medical Center system, a spokeswoman said. Officials said a 17-year-old boy and 14-year-old boy were in critical condition, a 17-year-old boy and a 16-year-old boy were in serious condition, and a 17-year-old boy and two 17-year-old girls were in fair condition.
In the meantime, Hribal was being questioned by police. His motive remains unknown.
The school issued a bulletin on its website saying: "A critical incident has occurred at the high school. All elementary schools are canceled, the middle school and high school students are secure. Additional information will be released as soon as possible. Please keep our campus clear of traffic."
The district serves about 3,600 students who live in the bedroom communities of Murrysville, Export and Delmont. The elementary and middle schools are part of the same campus.
The high school was on lockdown, and students were being kept there as a precaution as school and law enforcement officials double-checked the premises.
Morris Hundley described getting a frantic call from his 14-year-old daughter, Morriah, who was at the school at the time of the attack.
"She just called me frantically speaking that some kids got stabbed in the school," said Hundley. "They got stabbed and come get her now, she needed me or my wife to come get her."
Gov. Tom Corbett instructed state police to assist local investigators.
"I was shocked and saddened upon learning of the events that occurred this morning as students arrived at Franklin Regional High School. As a parent and grandparent, I can think of nothing more distressing than senseless violence against children. My heart and prayers go out to all the victims and their families," Corbett said in a statement.
A spokeswoman for the FBI's Pittsburgh field office says agents from her office are on the scene in Murrysville "assisting" police there, but police are leading the investigation. The FBI is there with a Crisis Management Team "available to assist all state and local police departments as needed," FBI spokeswoman said.
The district conducted an emergency exercise three months ago and a full-scale drill about a year ago.
Murrysville is about 15 miles east of Pittsburgh.
ABC News and The Associated Press contributed to this report.