Aims. Planets in the mass range from 2 to 15 M ⊕ are very diverse. Some of them have low densities, while others are very dense. By measuring the masses and radii, the mean densities, structure, and composition of the planets are constrained. These parameters also give us important information about their formation and evolution, and about possible processes for atmospheric loss. Methods. We determined the masses, radii, and mean densities for the two transiting planets orbiting K2-106. The inner planet has an ultra-short period of 0.57 days. The period of the outer planet is 13.3 days. . Conclusions. Since the system contains two planets of almost the same mass, but different distances from the host star, it is an excellent laboratory to study atmospheric escape. In agreement with the theory of atmospheric-loss processes, it is likely that the outer planet has a hydrogen-dominated atmosphere. The mass and radius of the inner planet is in agreement with theoretical models predicting an iron core containing 80 +20 −30 % of its mass. Such a high metal content is surprising, particularly given that the star has an ordinary (solar) metal abundance. We discuss various possible formation scenarios for this unusual planet.