The youth, who was under 16 when he committed his crime, had only just been released from his three and a half year prison sentence, which had been imposed for a serious sexual assault against a child.
Knowing that the youth was now free, Michael Loughran, 30, and Karl Carter, 27, decided to use Facebook to find out the secret location where police had rehoused him.
As he was being supervised by the public protection unit, the youth proved tricky to track down - so Loughran and Carter offered a £1,000 reward for information.
The jury at Teesside Crown Court heard that the pair eventually found out the secret address in Durham, and drove 16 miles from their homes in Middlesborough to lie in wait for him.
OUTRAGE AS FEMALE TWITTER USER REFERS TO ROMEO BECKHAM AS 'HOT'
Spotting the youth walking his dog on 28th June 2013, the pair beat him to the ground with baseball bats, leaving him with concussion and a 4cm cut to the back of his head.
Describing the attack, the lawyer for the prosecution said: “They rushed at him, striking him to the back and head and body with the baseball bats.
“He was knocked to the ground where the attack continued before they got back into their vehicle and left the scene.”
Both Carter and Loughran deny wounding with intent to cause grievous bodily harm and carrying an offensive weapon.
The trial continues.