In this paper we consider the cohomology of four groups related to the virtual braids of [Kauffman] and [Goussarov-Polyak-Viro], namely the pure and non-pure virtual braid groups (PvB_n and vB_n, respectively), and the pure and non-pure flat braid groups (PfB_n and fB_n, respectively). The cohomologies of PvB_n and PfB_n admit an action of the symmetric group S_n. We give a description of the cohomology modules H^i(PvB_n,Q) and H^i(PfB_n,Q) as sums of S_n-modules induced from certain one-dimensional representations of specific subgroups of S_n. This in particular allows us to conclude that H^i(PvB_n,Q) and H^i(PfB_n,Q) are uniformly representation stable, in the sense of [Church-Farb]. We also give plethystic formulas for the Frobenius characteristics of these S_n-modules. We then derive a number of constraints on which S_n irreducibles may appear in H^i(PvB_n,Q) and H^i(PfB_n,Q). In particular, we show that the multiplicity of the alternating representation in H^i(PvB_n,Q) and H^i(PfB_n,Q) is identical, and moreover is nil for sufficiently large \(n\). We use this to recover the (previously known) fact that the multiplicity of the alternating representation in H^i(PB_n,Q) is nil (here PB_n is the ordinary pure braid group). We also give an explicit formula for H^i(vB_n,Q) and show that H^i(fB_n,Q)=0. Finally, we give Hilbert series for the character of the action of S_n on H^i(PvB_n,Q) and H^i(PfB_n,Q). An extension of the standard `Koszul formula' for the graded dimension of Koszul algebras to graded characters of Koszul algebras then gives Hilbert series for the graded characters of the respective quadratic dual algebras.