We perform an analysis of the QCD lattice data on the baryon octet and decuplet masses based on the relativistic chiral Lagrangian. The baryon self energies are computed in a finite volume at next-to-next-to-next-to leading order (N$^3$LO), where the dependence on the physical meson and baryon masses is kept. The number of free parameters is reduced significantly down to 12 by relying on large-$N_c$ sum rules. Altogether we describe accurately more than 220 data points from six different lattice groups, BMW, PACS-CS, HSC, LHPC, QCDSF-UKQCD and NPLQCD. Values for all counter terms relevant at N$^3$LO are predicted. In particular we extract a pion-nucleon sigma term of 39$_{-1}^{+2}$ MeV and a strangeness sigma term of the nucleon of $sigma_{sN} = 84^{+ 28}_{-;4}$ MeV. The flavour SU(3) chiral limit of the baryon octet and decuplet masses is determined with $(802 pm 4)$ MeV and $(1103 pm 6)$ MeV. Detailed predictions for the baryon masses as currently evaluated by the ETM lattice QCD group are made.