Two wardens at the Goodwood Correctional Facility in the Western Cape were allegedly stabbed by inmates on Sunday morning, the correctional services department said.
The incident happened at around 08:00 when the wardens were opening cells to feed the offenders, spokesperson Simphiwe Xako said.
"Two of them got seriously stabbed and had to be rushed to hospital but they were later discharged," he said.
Xako said it is believed that the attack was part of prison gang ritual.
"It involved members of both the 28 and 26 gang. Fortunately we were assisted by police services and we searched all the cells and confiscated a number of self-made weapons such as knives."
Xako said the search was ongoing and they were monitoring the situation closely.