New Breakthrough Detecting AI-Written code is now easier and more accurate with the latest engine update. Start checking Start checking Read more
New: MCP integration. Run plagiarism scans from Claude, Cursor or any AI assistant. Run scans from Claude or Cursor. Set it up

What MOSS misses

MOSS finds pairs of students whose code shares long runs of tokens, and it does that well. But a low MOSS score does not mean a submission is original. MOSS cannot see code copied from Stack Overflow or GitHub, code written by AI, or a copy that was rewritten, and its own documentation and published research by computer science faculty say so. This brief shows each one on a fixed example, with the papers behind it.

2-day free trial. Checks every file against classmates, the web and AI, in 65+ languages.

The same function, rewritten line by line Identical behavior. Very few token runs in common.
Example
Originalstats.py
1def find_max(numbers):2 maximum = numbers[0]3 for n in numbers:4 if n > maximum:5 maximum = n6 return maximum
Rewrittenstats.py
1def find_max(numbers):2 maximum = numbers[0]3 index = 04 while index < len(numbers):5 value = numbers[index]6 if not (value <= maximum):7 maximum = value8 index = index + 19 return maximum
Behavior: identicalNames: unchangedToken runs in common: few

The loop and the comparison were rewritten into equivalent forms (highlighted). A fingerprint comparison looks at runs of tokens, and almost every run changed.

How MOSS works

MOSS reads each file as a stream of tokens, so names, comments and whitespace drop out. It hashes short runs of those tokens into fingerprints using winnowing, then reports the pairs of files that share the most fingerprints.

That is why renaming variables does nothing against MOSS. It is also why MOSS has these blind spots:

Anything outside the batch

MOSS only compares the files you send. Stack Overflow, GitHub, tutorial sites and last year's class are invisible unless you add them yourself.

AI-written code

Generated code is usually different for every student, so it matches nothing in the batch.

Rewritten statements

If the token runs change, the fingerprints change, even when the program does exactly the same thing.

Results that expire

The MOSS page says results are typically deleted after 14 days, so the evidence has to be saved by hand.

What the research says

None of this is our claim alone. MOSS's author says it plainly, and computer science researchers have measured each blind spot. In their own words:

  1. “while Moss automatically detects program similarity, it has no way of knowing why codes are similar.”
    Alex Aiken, Stanford UniversityMOSS documentationRead it

    The same page adds that "it is a misuse of Moss to rely solely on the similarity scores."

  2. “Mossad is effective at defeating four plagiarism detectors, including Moss and JPlag.”
    Breanna Devore-McDonald and Emery D. Berger, UMass AmherstOOPSLA 2020Read it

    Their tool rewrites a copied program automatically, in minutes, into variants that are "classified as no more suspicious than legitimate assignments."

  3. “they are vulnerable to advanced obfuscation based on structural modification of program code that preserves the original program behavior.”
    Timur Sağlam and Larissa Schmid, Karlsruhe Institute of Technology2025Read it

    Written by the team behind JPlag, about plagiarism detectors in general, including AI-generated rewrites.

  4. “a student using GPT-J ... can complete introductory level programming assignments without triggering suspicion from MOSS”
    Stella Biderman and Edward Raff2022Read it

    They also found the generated code "diverse in structure", so there is no single pattern for a similarity tool to look for.

  5. “Existing detection methods, such as MOSS and JPlag (based on similarity metrics) and GPTzero (AI detection), have mixed success in identifying AI solutions.”
    Kevin Wang, Seth Akins, Abdallah Mohammed and Ramon LawrenceIEEE CSCI 2023Read it

    Measured across three courses: CS1, CS2 and databases.

  6. “ChatGPT generates code non-deterministically, and thus, traditional similarity detectors might not suffice to detect AI-created code.”
    Muntasir Hoq, Thomas Price, Bita Akram and colleagues, NC State UniversitySIGCSE 2024Read it

    Models trained for the job did detect it: they report "accuracy above 90%" on CS1 submissions.

Rewritten copies

The example at the top uses four ordinary rewrites, each of which leaves the program's behavior unchanged:

  • A counted for loop becomes an equivalent while loop.
  • A compound assignment like total += n is expanded into total = total + n.
  • A comparison is inverted and negated: n > m becomes not (value <= m).
  • An indexed value is pulled into its own named variable.

None of these is sophisticated, and they no longer have to be done by hand. Devore-McDonald and Berger's Mossad does it automatically in minutes, and Sağlam and Schmid found detectors vulnerable to exactly this kind of behavior-preserving change, including rewrites done by AI. A person reading the two files side by side sees the same function immediately.

What catches it: comparing structure at a higher level than token runs, and reading the top pairs yourself. Codequiry's Zeus engine is built for restructured code like this.

What Codequiry catches that MOSS cannot

A Codequiry check runs the same peer comparison MOSS does. Then it checks every file against GitHub, Stack Overflow, Gist, Software Heritage and the open web, and runs two AI detection models on it. These are the three cases a MOSS batch has nothing to say about.

Copied from Stack Overflow

A student finds an answer, renames everything, and submits it. Nobody else in the class used that answer, so MOSS has nothing to pair it with.

A Stack Overflow answer, renamed Same logic, same structure. Only the names changed.
Example
Student submissionbrackets.py
1def check_brackets(expr):2 match = {')': '(', ']': '[', '}': '{'}3 opened = []4 for c in expr:5 if c in '([{':6 opened.append(c)7 elif c in match:8 if not opened or opened.pop() != match[c]:9 return False10 return not opened
Stack Overflow answeranswer
1def is_balanced(s):2 pairs = {')': '(', ']': '[', '}': '{'}3 stack = []4 for ch in s:5 if ch in '([{':6 stack.append(ch)7 elif ch in pairs:8 if not stack or stack.pop() != pairs[ch]:9 return False10 return not stack
Classmates with this code: noneMOSS: no matchCodequiry: matched to Stack Overflow

Every name was changed (highlighted). Renaming does not fool a token comparison, but MOSS can only compare this file with the other files you sent, and nobody else in the class used this answer.

Copied from GitHub

Past students publish their homework, and the next class finds it. Unless you add every public repository to the batch yourself, MOSS never sees it.

Last year's homework, from a public GitHub repo Same messages, same odd log format, new names.
Example
Student submissionAccount.java
1public boolean withdraw(double amount) {2 if (amount <= 0) {3 System.out.println("Invalid amount entered.");4 return false;5 }6 if (amount > funds) {7 System.out.println("Insufficient funds. Balance: $" + funds);8 return false;9 }10 funds -= amount;11 log.add("W:" + amount);12 return true;13}
Public GitHub repositoryBankAccount.java
1public boolean withdraw(double amt) {2 if (amt <= 0) {3 System.out.println("Invalid amount entered.");4 return false;5 }6 if (amt > balance) {7 System.out.println("Insufficient funds. Balance: $" + balance);8 return false;9 }10 balance -= amt;11 history.add("W:" + amt);12 return true;13}
Classmates with this code: noneMOSS: no matchCodequiry: matched to GitHub

Only the names changed (highlighted). The exact error messages and the W: log entries are the kind of detail two people do not invent independently, and they point straight at the repository.

Written by AI

There is nothing to match: the code was never anywhere before the student asked for it. Only a check built for AI-written code has anything to say about it.

A CS1 exercise, written by an AI assistant No match in the class, on the web, or in past terms.
Example
Student submissionwords.py
1def count_word_frequencies(text: str) -> dict[str, int]:2 """Return how often each word appears in the text."""3 frequencies: dict[str, int] = {}4 for raw_word in text.lower().split():5 # Strip punctuation so "end." and "end" count once6 word = raw_word.strip(".,!?;:()")7 if word:8 frequencies[word] = frequencies.get(word, 0) + 19 return frequencies
  • Peer comparison (MOSS)No match
  • Web checkNo match
  • AI detection: Classification ModelLikely AI-written
  • AI detection: Pattern & Style RecognizerConsistent with AI-written code

Both comparisons come back clean, because there is nothing to compare against. Codequiry's Classification Model is trained on 100,000 AI-written and 100,000 human-written samples and kept current with new models. Like any AI check, treat its result as a question for the student, not a verdict.

Two recent flags

C++submission.cpp 80%
8int n = s.length();9vector<int> ans(n, 0);10int count = 0;11 12for(int i = 0; i < n; i++) {13 14 ans[i] = count;15 16 if(s[i-1] == s[i] || s[i] == s[i+1] || s[i-1] == s[i] + 1 || s[i-1] + 1 == s[i] || s[i+1] == s[i] + 1 || s[i+1] + 1 == s[i] )
20 lines copied Found on the web · 4 hours ago
Pythonsubmission.py 97%
1def __init__(2 self,3 num_states=100,4 num_actions=4,5 alpha=0.2,6 gamma=0.9,7 rar=0.5,8 radr=0.99,9 dyna=0,
20 lines copied Found on the web · 11 hours ago

Real flags from Codequiry. Student names, comments and strings are removed before anything is shown here.

Check what MOSS cannot see

Run the same batch against classmates, past terms, GitHub, Stack Overflow, the web and AI.

Start free trial

2-day free trial

What to do about it

You do not need to stop using MOSS. You need to stop treating its report as the whole answer, which is what the MOSS page itself says:

  1. Keep the peer comparison, with the starter code passed as a base file.
  2. Add a web check against GitHub, Stack Overflow and the web, and include earlier terms.
  3. Add an AI check, and treat its result as a question for the student, not a verdict.
  4. Read the top pairs yourself. Look for shared bugs, odd names, identical messages and dead code, which survive any rewrite.
  5. Save the evidence before it expires.

Codequiry does steps 1 to 3 in one check and keeps every report. Comparing the free options instead? See MOSS vs Dolos vs JPlag, or read the full guide to detecting code plagiarism.

Frequently asked questions

What is MOSS?

MOSS (Measure of Software Similarity) is a free service from Stanford, written by Alex Aiken in 1994, that compares a batch of programs with each other. It is free for academic use and widely used in programming courses.

How does MOSS detect plagiarism?

It turns each file into a stream of tokens, hashes short runs of tokens into fingerprints with an algorithm called winnowing, and reports pairs of files that share many fingerprints. Names, comments and whitespace do not affect it.

What does MOSS miss?

Code copied from Stack Overflow, GitHub or another website that no classmate also used, code written by AI, copies whose statements were rewritten into equivalent forms, and anything from earlier terms you did not add to the batch yourself.

Can MOSS detect ChatGPT or other AI-written code?

Not reliably. MOSS compares students with each other, and AI output usually differs from student to student. Biderman and Raff (2022) found AI-written solutions to introductory assignments did not trigger MOSS, and Hoq et al. (SIGCSE 2024) note that similarity detectors might not suffice for AI-created code.

Does a low MOSS score mean a submission is original?

No. It means the file shares few token runs with the other files in the batch. The code can still be copied from the web, rewritten from a classmate's work, or written by AI.

Should I stop using MOSS?

Not necessarily. It is a good peer comparison. Just do not treat it as the whole check: add a web check and an AI check, and read the top pairs yourself, as the MOSS page itself advises.

Sources

  1. Aiken, A. Moss: A System for Detecting Software Similarity. Stanford University. theory.stanford.edu/~aiken/moss
  2. Schleimer, S., Wilkerson, D. S. and Aiken, A. Winnowing: Local Algorithms for Document Fingerprinting. SIGMOD 2003. PDF
  3. Devore-McDonald, B. and Berger, E. D. Mossad: Defeating Software Plagiarism Detection. Proc. ACM Program. Lang. 4 (OOPSLA), 2020. doi:10.1145/3428206
  4. Biderman, S. and Raff, E. Fooling MOSS Detection with Pretrained Language Models. 2022. arXiv:2201.07406
  5. Wang, K., Akins, S., Mohammed, A. and Lawrence, R. Student Mastery or AI Deception? Analyzing ChatGPT's Assessment Proficiency and Evaluating Detection Strategies. IEEE CSCI 2023. arXiv:2311.16292
  6. Hoq, M., Shi, Y., Leinonen, J., Babalola, D., Lynch, C., Price, T. and Akram, B. Detecting ChatGPT-Generated Code Submissions in a CS1 Course Using Machine Learning Models. SIGCSE 2024. doi:10.1145/3626252.3630826
  7. Sağlam, T. and Schmid, L. Evaluating Software Plagiarism Detection in the Age of AI: Automated Obfuscation and Lessons for Academic Integrity. 2025. arXiv:2505.20158

See what your last MOSS batch missed

Upload the same files and check them against classmates, past terms, GitHub, Stack Overflow, the web and AI.

Start free trial

2-day free trial

Just one assignment? Run a deep scan
From instructors

What instructors say

  • Codequiry protects our course from copying. It's the only tool we found reliable.
    Course instructor
  • The best experience I've had checking source code for plagiarism on the web. They even cover Stack Overflow!
    Codequiry user
  • As a professor at Stanford, I want to make sure students submit code they wrote themselves. Codequiry checks source code for plagiarism on the web, which other checkers can't do.
    Professor, Stanford University
Sources

Tools referenced on this page

Codequiry is compared with these tools above. Each card links to the project's official site, so you can check the claims yourself.

Topic index

Explore Codequiry's code plagiarism detection toolkit

Dig deeper into the most accurate source-code plagiarism checker on the market, every language, every detection engine, every academic-integrity use case.