Weight Painting is not working
Weight painting gives a strength value to a vertex or to some vertices, it determines the level of influence a group has on this vertex or on those vertices. If there is no vertex it can't paint.

You say that it paints through the object. Maybe you've given your object a Solidify modifier (is it what you mean when you talk about Solidary)? In that case apply the modifier. The other possibility is that you've enabled the 2D Falloff option, deactivate it in the N panel > Tool > Brush > Options.

You don't say anything about these sprinkles and you don't explain what you mean by "passing through the box"... If they are Particles > Hair objects and if you want them to appear only on some parts of the box you need to create a vertex group and select it in the Particles panel > Vertex Groups > Density. If they are Particles > Emitter, maybe you need to choose Faces instead of Volume in the Particles panel > Emission > Source > Emit From.