Council officials are investigating the incident at Heathfield Primary School in Ayr and said they were "offering appropriate and ongoing support to both individuals".
It is understood that the teacher has been off work since the attack although the young pupil has remained at school. Police have confirmed that a boy was the subject of a report to the Scottish Children's Reporters Association.
The incident is said to have happened in January while the victim, a principal teacher at the 530-pupil school, was taking a detention session after the boy had been sent to her by his Primary 5 teacher.
A spokesman for the Educational Institute of Scotland (EIS), the country's biggest teaching union, urged the authorities to take a "firm line" with the offender.
He said: "All school and local authority discipline policies should take a firm line when violence is either used or threatened against any member of staff. It's an issue of serious concern whenever a teacher is attacked or threatened in the workplace. There is no instance where it's acceptable for a pupil to use violence against a teacher.
"While the EIS does not comment on individual cases, the issue of attacks or threatened attacks on teachers is a serious problem. Although the number of attacks is relatively small when compared to the number of pupils in our schools, the reality is that one assault on a teacher is one too many.
"Both teachers and the vast majority of well-behaved pupils deserve a safe and secure environment in schools, so any incidents of violence or threatened violence must be dealt with swiftly and in line with the council's discipline guidelines."
Douglas Hutchison, South Ayrshire Council's head of education, said: "We are aware of the incident at Heathfield Primary School and we are offering appropriate and ongoing support to both individuals.
"Incidents such as this are extremely rare and we have robust policies and procedures in place to deal with them, and these have been followed.
"The safety and wellbeing of our pupils and our staff is of utmost importance to us and we continue to offer all relevant support to make sure a secure and positive learning environment is provided at all times.
"This matter has been reported to the police and therefore we cannot comment further."
A Police Scotland spokeswoman said: "A nine-year-old boy was the subject of a report to the Scottish Children's Reporters Association in connection with the alleged assault of a 49-year-old female teacher at a school in Ayr on Friday January 31."
In her address in the school's handbook, headteacher Carol Shearing says: "We aim to develop 'A Curriculum for Excellence' in line with national guidelines in order to deliver the most appropriate curriculum to meet the needs of all our children today.
"We are also concerned with the emotional and social development of our pupils."