In the first sections we extend and generalize Gröbner basis theory to submodules of free right modules over monoid rings. Over free monoids, we adapt the known theory for right ideals and prove versions of Macaulay's basis theorem, the Buchberger criterion, and the Buchberger algorithm. Over monoids presented by a finitely generated convergent string rewriting system we generalize Madlener's Gröbner basis theory based on prefix reduction from right ideals to right modules. After showing how these Gröbner basis theories relate to classical group-theoretic problems, we use them as a basis for a new class of cryptosystems that are generalizations of the cryptosystems described in [2] and [8]. Well known cryptosystems such as RSA, El-Gamal, Polly Cracker, Polly Two and a braid group cryptosystem are shown to be special cases. We also discuss issues related to the security of these Gröbner basis cryptosystems.