The culprits, who were drunk, knocked on the door of the family home where the boy lived on Thursday evening, police in Saxony-Anhalt reported on Friday.
When the boy’s father, who is originally from Liberia, opened the door the men, aged 47 and 63, immediately attacked him, using a baton and a knuckle duster.
The boy’s mother was also in the house at the time and attempted to protect her husband, but also ended up being assaulted.
Mother and son were taken to hospital where they were treated for bruising. The child had sustained injuries to his head.
The father was treated at the scene of the crime.
Police have arrested the two men and are investigating whether there was a racist motive to the crime.
According to Die Welt, the men shouted racist insults during the attack. They live on the same street as their victims, but are not believed to have known them personally.
Racist crime has increased sharply since German took in just under 900,000 refugees last year. The problem is particularly pronounced in the states of former East Germany, where refugees have spoken of living in fear.
Also on Thursday, a teenage refugee was attacked at a metropolitan rail station in the Berlin district of Neukölln. The 17-year-old immediately reported the crime.In the capital, 50 more cases of far-right crime were reported against foreigners in the first six months of 2016 as in the same period in 2015, Tagesspiegel reports.