Police became aware of the situation on July 22 when the boy ran away and was returned home by police, CPS spokeswoman Estella Olguin told the Houston Chronicle.
"We got the call once the police found him and took him back home and discovered his living conditions," Olguin said. "We took emergency custody that same day."
When police arrived at the home, the boy's father took them to a small laundry or utility room and told them that was the child's room, according to a court affidavit for a search warrant. There was an 8-by-6 foot particle board box, a small blanket and a pair of socks in the room, the court documents state. The boy's father told police he kept the boy locked in the room.
The boy told police he "ran away from home because he did not want to be locked in his room," the Galveston Daily News reported from the court documents.
The boy also told police his father and stepmother wrote words like "liar" and "thief" on his naked body, took cellphone pictures of him that way and threatened to post the images on a social media website.
Police said in the search warrant affidavit they were looking for evidence of child pornography. The Associated Press does not identify victims of suspected sex crimes.
No charges have been filed, but the Galveston County District Attorney Jack Roady said the investigation is ongoing.
CPS is working with an out-of-state child welfare agency to see whether the boy's mother can provide him a safe home. The mother arrived in Galveston after learning her son had been placed in foster care.