The origin of hard X-rays and γ-rays emitted from the solar atmosphere during occulted solar flares is still debated. The hard X-ray emissions could come from flaring loop tops rising above the limb or coronal mass ejection shock waves, two by-products of energetic solar storms. For the shock scenario to work, accelerated particles must be released on magnetic field lines rooted on the visible disk and precipitate. We present a new Monte Carlo code that computes particle acceleration at shocks propagating along large coronal magnetic loops. A first implementation of the model is carried out for the 2014 September 1 event, and the modeled electron spectra are compared with those inferred from Fermi Gamma-ray Burst Monitor (GBM) measurements. When particle diffusion processes are invoked, our model can reproduce the hard electron spectra measured by GBM nearly 10 minutes after the estimated on-disk hard X-rays appear to have ceased from the flare site.