The defender, who turned 18 in March, is in advanced talks to sign a new deal as part of "Operation Shield", a policy where Real management are securing their young players to new deals.
Jesus Fortea recently signed a new contract with Real and now Rivas is due to follow.
Former Castilla coach Raul has said of Rivas: "There's little talk about Mario. I think it's time to appreciate how well he's doing. He's a very dedicated, hard-working lad who has wanted to learn from the start and, without making much noise, is growing every day.
"He's a second-year youth player, imagine everything he still has to learn . Asencio, who has become indispensable in the first team, and Jacobo Ramón, who is part of the dynamic first team, will be hard-pressed to see them with Castilla, and Mario has made a name for himself.
"He looks more sober, disciplined, and forceful every time, and he works humbly. He's growing every day and has a very promising and great future."