How to secure a wooden box (tunnel) in a wall?
First, I recommend against MDF. Yes, it has a great smooth surface, but it just doesn't have much structural strength. I would recommend plywood, maybe 1/2 or 3/4 inches thick.

If it were plywood, I would say put a plywood "collar" on each end of the tunnel, with screws from inside the edge of the tunnel into the plywood ring around it. If you have one on either end, this locks the tunnel in place, and even if someone gave it a good kick, it should stay in place. However, with MDF, you don't have that much strength, so you may need some other way of attaching the "collar". Hope this helps.