How do I stop HDRI light going through my object?
Short answer: using Irradiance Volumes might help...

Long answer:

Cycles is using ray tracing so shadows of HDRI are a given, i.e. when the ray calculation is bouncing inside the box, there is little chance of it getting to any of the light source of the HDRI through the hole inside your box, or no chance at all if the box is completely sealed (rays are calculated backward from the camera).

Eevee is not a ray tracer and the global illumination (GI) and shadows from an HRDI background texture can only be approximated using irradiance volumes and baking the results on top of existing materials. Eevee cannot do realtime calculation of shadows and indirect lighting of the lightsource emitted by every pixel of your HDRI texture. For realtime, Eevee only calculates the direct illumination of the HDRI on all faces of the scene and adds the indirect lighting stuff only if it has been baked (or until Eevee supports AMD ProRender or NVidia RTX for GI :) ).

In the basic example below, you can see that after setting an Irradiance Volume and Baking Indirect Lighting (under Render Properties), low res shadows start to appear inside the cube. Playing around with multipls Irrandiance Volumes and their resolution and other aspects might help but in general, stick to Cycles for true GI.



Credit: Beautiful sunset HDRI from Greg Zaal (https://hdrihaven.com/hdri/?c=outdoor&amp;h=cape_hill)