CWE-687 Variant Draft

Function Call With Incorrectly Specified Argument Value

This vulnerability occurs when a function is called with an argument that holds an incorrect or unexpected value, leading to unintended program behavior or security flaws.

Definition

What is CWE-687?

This vulnerability occurs when a function is called with an argument that holds an incorrect or unexpected value, leading to unintended program behavior or security flaws.
Incorrect argument values often happen due to simple mistakes like mixing up parameter order, using hard-coded magic numbers, or passing a variable that hasn't been properly validated. For example, calling a file permission function with a value meant for a buffer size can expose sensitive data or crash the application. These errors are subtle because the code compiles and runs, but the logic is fundamentally broken, creating a gap between what the developer intended and what actually executes. Finding these mismatches manually in a large codebase is like searching for a needle in a haystack. While SAST tools can flag suspicious patterns, Plexicus uses AI to not only detect these flaws but also generate the precise code fix, transforming a generic warning into an actionable correction. This saves significant manual review time and helps ensure that the function receives the exact value it was designed to handle, closing the door on a wide range of downstream vulnerabilities.
Auswirkungen in der Praxis

Real-world CVEs caused by CWE-687

Bisher sind in MITREs Katalog keine öffentlichen CVE-Referenzen mit dieser CWE verknüpft.

Wie Angreifer es ausnutzen

Angreiferpfad Schritt für Schritt

  1. 1

    Identifiziere einen Codepfad, der nicht vertrauenswürdige Eingaben ohne Validierung verarbeitet.

  2. 2

    Erzeuge eine Payload, die das unsichere Verhalten auslöst — Injection, Traversal, Overflow oder Logik-Missbrauch.

  3. 3

    Liefere die Payload über einen normalen Request aus und beobachte die Reaktion der Anwendung.

  4. 4

    Iteriere, bis die Antwort Daten preisgibt, Angreifer-Code ausführt oder Berechtigungen eskaliert.

Verwundbares Codebeispiel

Vulnerable Perl

This Perl code intends to record whether a user authenticated successfully or not, and to exit if the user fails to authenticate. However, when it calls ReportAuth(), the third argument is specified as 0 instead of 1, so it does not exit.

Verwundbar Perl
sub ReportAuth {
  	my ($username, $result, $fatal) = @_;
  	PrintLog("auth: username=%s, result=%d", $username, $result);
  	if (($result ne "success") && $fatal) {
  		die "Failed!\n";
  	}
  }
  sub PrivilegedFunc
  {
  	my $result = CheckAuth($username);
  	ReportAuth($username, $result, 0);
  	DoReallyImportantStuff();
  }
Sicheres Codebeispiel

Secure pseudo

Sicher pseudo
// Validate, sanitize, or use a safe API before reaching the sink.
function handleRequest(input) {
  const safe = validateAndEscape(input);
  return executeWithGuards(safe);
}
What changed: the unsafe sink is replaced (or the input is validated/escaped) so the same payload no longer triggers the weakness.
Präventions-Checkliste

How to prevent CWE-687

  • Architecture Use safe-by-default frameworks and APIs that prevent the unsafe pattern from being expressible.
  • Implementation Validate input at trust boundaries; use allowlists, not denylists.
  • Implementation Apply the principle of least privilege to credentials, file paths, and runtime permissions.
  • Testing Cover this weakness in CI: SAST rules + targeted unit tests for the data flow.
  • Operation Monitor logs for the runtime signals listed in the next section.
Erkennungssignale

How to detect CWE-687

Manual Static Analysis

This might require an understanding of intended program behavior or design to determine whether the value is incorrect.

Plexicus Auto-Fix

Plexicus erkennt CWE-687 automatisch und öffnet in unter 60 Sekunden einen Fix-PR.

Codex Remedium scannt jeden Commit, identifiziert genau diese Schwachstelle und liefert einen reviewer-ready Pull Request mit dem Patch. Keine Tickets. Keine Hand-offs.

Häufig gestellte Fragen

Frequently asked questions

Was ist CWE-687?

This vulnerability occurs when a function is called with an argument that holds an incorrect or unexpected value, leading to unintended program behavior or security flaws.

Wie gravierend ist CWE-687?

MITRE hat für diese Schwachstelle keine Exploit-Wahrscheinlichkeit veröffentlicht. Behandle sie als mittlere Auswirkung, bis dein Threat Model anderes belegt.

Welche Sprachen oder Plattformen sind von CWE-687 betroffen?

MITRE hat für diese CWE keine betroffenen Plattformen spezifiziert — sie kann in den meisten Anwendungs-Stacks auftreten.

Wie kann ich CWE-687 verhindern?

Use safe-by-default frameworks, validate untrusted input at trust boundaries, and apply the principle of least privilege. Cover the data-flow signature in CI with SAST.

Wie erkennt und behebt Plexicus CWE-687?

Die SAST-Engine von Plexicus erkennt die Datenfluss-Signatur von CWE-687 bei jedem Commit. Bei einem Treffer öffnet unser Codex-Remedium-Agent einen Fix-PR mit korrigiertem Code, Tests und einer einzeiligen Zusammenfassung für den Reviewer.

Wo erfahre ich mehr über CWE-687?

MITRE veröffentlicht die kanonische Definition unter https://cwe.mitre.org/data/definitions/687.html. Für ergänzende Hinweise kannst du auch die OWASP- und NIST-Dokumentation heranziehen.

Bereit, wenn du es bist

Schluss mit dem Bezahlen pro Entwickler.
Schließ den Kreislauf.

Plexicus ist die KI-native ASPM, die scannt, filtert, fixt, pentestet und erklärt — autonom. Unbegrenzte Entwickler, unbegrenzte Repos, Fair-Use-KI-Aktionen. Echter kostenloser Tarif, €269/mo jährlich, wenn du bereit bist.