In this paper, the instability of layered two-phase flows caused by the presence of a soluble surfactant (or a surface active solute) is studied. The fluids have different viscosities, but are density matched to focus on Marangoni effects. The fluids flow between two flat plates, which are maintained at different solute concentrations. This establishes a constant flux of solute from one fluid to the other in the base state. A linear stability analysis is performed, using a combination of asymptotic and numerical methods. In the creeping flow regime, Marangoni stresses destabilize the flow, provided a concentration gradient is maintained across the fluids. One long wave and two short wave Marangoni instability modes arise, in different regions of parameter space. A well-defined condition for the long wave instability is determined in terms of the viscosity and thickness ratios of the fluids, and the direction of mass transfer. Energy budget calculations show that the Marangoni stresses that drive long and short wave instabilities have distinct origins. The former is caused by interface deformation while the latter is associated with convection by the disturbance flow. Consequently, even when the interface is non-deforming (in the large interfacial tension limit), the flow can become unstable to short wave disturbances. On increasing $Re$, the viscosity-induced interfacial instability comes into play. This mode is shown to either suppress or enhance the Marangoni instability, depending on the viscosity and thickness ratios. This analysis is relevant to applications such as solvent extraction in microchannels, in which a surface-active solute is transferred between fluids in parallel stratified flow. It is also applicable to the thermocapillary problem of layered flow between heated plates.