Cox, 28, spent time with the Broncos and Seahawks, and had two different stints with the 49ers since 2012. He started 14 of 15 games last season and led San Francisco with five interceptions. He has registered 136 total tackles and six interceptions in his NFL career.
Free agent wideout Steve Johnson, who was thought to be headed to the Patriots, instead signed with the Chargers, the Chargers announced. Johnson, 28, spent one season with the 49ers, catching 35 passes for 435 yards and three touchdowns, after a productive six-year stint in Buffalo.