One officer had to have his eye cleaned by medics and required antibiotics after the attack by Ian Shipley.
Leeds Crown Court heard Shipley sprayed the poisonous liquid from a Radox shower gel bottle after he became angry when he was unable to make a phone call.
Carmel Pearson, prosecuting, said Shipley had been moved to HMP Leeds in June last year after he attacked a prison officer at HMP Liverpool.
The incident happened on June 23 when Shipley, 36, became angry after the two officers told him he had to return to his cell.
Miss Pearson said Shipley was frustrated because the phone call he had been trying to make would not connect.
CCTV footage showed Shipley becoming agitated and aggressive..
He said to the officers: "I will just s*** you up then."
The prosecutor said: "He produced a bottle that transpired to be an old shower gel bottle filled with faeces and urine and he sprayed the contents of that bottle at both officers."
Other inmates on the landing recoiled in horror as they witnessed the attack.
Both officers were covered in the liquid.
They were taken to Leeds General Infirmary for treatment.
Medics were so concerned for one of the officers that his eye had to be rinsed out.
He was given antibiotic drops because the liquid had changed the pH level in his eye.
The officer is a former soldier who has served tours in the armed forces across the world.
He described the attack as the worst thing that had ever happened to him.
The other officer described in a victim statement how he had lost sleep and was shocked and disgusted by the attack.
Shipley refused to comment when interviewed.
He pleaded guilty to two offences of administering a noxious or poisonous substance.
Shipley has previous convictions for attacking police and prison officers.
He was given a sentence of seven years, six months in January last year for a violent robbery at a convenience store.
Simeon Evans, mitigating, said: "He wishes to express genuine remorse and would like to apologise to the prison officers.
"He does not suggest that they did anything to him that warranted any form of assault or resistance.
"He insists that he doesn't wish to carry on in this way any more and wishes to work towards his eventual release."
Shipley was given a sentence of two-and-a-half years, to run consecutively to the sentence he is currently serving.
Judge Christopher Batty said: "There was an intention to injure a public servant and an intention to humiliate and demean them and cause significant distress."