  We review the hypothesis that the acceleration of protons at internal shocks
in Gamma Ray Bursts (GRB) could be the origin of the ultra-high energy cosmic
rays (UHECR) observed at earth, E_max > 10^19 eV. We find that, even though
protons may be accelerated to such energies, their ejection into the
interstellar/intergalactic medium is problematic because it is likely to be
accompanied by considerable adiabatic losses in the expanding shell. The
problem is circumvented by neutrons produced in photohadronic interactions,
which are not magnetically bound and thus effectively ejected in the moment of
their production. They can be both produced in sufficient number and be able to
leave the emission region if the optical depth of the emission region to
photohadronic interactions is of order 1. We show that this requirement can be
fulfilled under the same conditions which allow acceleration of protons to the
highest energies. The production of neutrinos in this process correlates the
fluxes of cosmic rays and neutrinos, and makes the hypothesis of UHECR origin
in GRBs testable.
