encyclopegia.org

Taint checking

Taint checking is a feature in some computer programming languages, such as Perl, Ruby or Ballerina designed to increase security by preventing malicious users from executing commands on a host computer. Taint checks highlight specific security risks primarily associated with web sites which are attacked using techniques such as SQL injection or buffer overflow attack approaches.

Taint checking is a feature in some computer programming languages, such as Perl, Ruby or Ballerina designed to increase security by preventing malicious users from executing commands on a host computer. Taint checks highlight specific security risks primarily associated with web sites which are attacked using techniques such as SQL injection or buffer overflow attack approaches. ==Overview== The concept behind taint checking is that any variable that can be modified by an outside user (for example a variable set by a field in a web form) poses a potential security risk. If that variable is used in an expression that sets a second variable, that second variable is now also suspicious. The taint checking tool can then proceed variable by variable forming a list of variables which are potentially influenced by outside input. If any of these variables is used to execute dangerous commands (such as direct commands to a SQL database or the host computer operating system), the taint checker warns that the program is using a potentially dangerous tainted variable. The computer programmer can then redesign the program to erect a safe wall around the dangerous input. Taint checking may be viewed as a conservative approximation of the full verification of non-interference or the more general concept of secure information flow. Because information flow in a system cannot be verified by examining a single execution trace of that system, the results of taint analysis will necessarily reflect approximate information regarding the information flow characteristics of the system to which it is applied. !/usr/bin/env perl my $name = $cgi->param("name"); # Get the name from the browser ... $dbh->{TaintIn} = 1; $dbh->execute("SELECT * FROM users WHERE name = '$name';"); # Execute an SQL query If taint checking is turned on, Perl would refuse to run the command and exit with an error message, because a tainted variable is being used in a SQL query. Without taint checking, a user could enter foo'; DROP TABLE users -- , thereby running a command that deletes the entire database table. Much safer would be to encode the tainted value of $name to a SQL string literal and use the result in the SQL query, guaranteeing that no dangerous command embedded in $name will be evaluated. Another way to achieve that is to use a prepared statement to sanitize all variable input for a query. One thing to note is that Perl DBI requires one to set the TaintIn attribute of a database handle as well as enabling taint mode to check one's SQL strings. ==History== Perl supported tainting in setuid scripts from at least version 3.0 (released in 1989), though it was not until version 5.0 (released in 1994) that the -T switch was introduced integrating tainting into a single runtime. In 1996, Netscape implemented data tainting for JavaScript in Netscape Navigator 3. However, since support was considered experimental, it shipped disabled (requiring user intervention to activate) and required page authors to modify scripts to benefit from it. Other browser vendors never implemented the functionality. ==References== ==External links== Guidelines from the W3C about taint-checking CGI scripts perlsec - Perl security documentation

References

  1. Programming Ruby --- The Pragmatic Programmer's Guide . Addison Wesley Longman. 2001. pp. 253 (Ch. 20). Wikipedia revision 1371801524, retrieved 2026-11-18 · retrieved 2026-11-17 · rev 1371801524
    Cite this reference

    MLA "Programming Ruby --- The Pragmatic Programmer's Guide . Addison Wesley Longman. 2001. pp. 253 (Ch. 20). Wikipedia revision 1371801524, retrieved 2026-11-18." Programming Ruby --- The Pragmatic Programmer's Guide. 2026-11-17. http://www.ruby-doc.org/docs/ProgrammingRuby/html/taint.html. Accessed 24 November 2026.

    Chicago "Programming Ruby --- The Pragmatic Programmer's Guide . Addison Wesley Longman. 2001. pp. 253 (Ch. 20). Wikipedia revision 1371801524, retrieved 2026-11-18." Programming Ruby --- The Pragmatic Programmer's Guide. 2026-11-17. http://www.ruby-doc.org/docs/ProgrammingRuby/html/taint.html.

    APA Programming Ruby --- The Pragmatic Programmer's Guide. (2026). Programming Ruby --- The Pragmatic Programmer's Guide . Addison Wesley Longman. 2001. pp. 253 (Ch. 20). Wikipedia revision 1371801524, retrieved 2026-11-18. Retrieved November 24, 2026, from http://www.ruby-doc.org/docs/ProgrammingRuby/html/taint.html

  2. Ballerina - Taint Checking · retrieved 2022-02-14 · rev 1371801524
    Cite this reference

    MLA "Ballerina - Taint Checking." Inc, WSO2. 2022-02-14. https://ballerina.io/1.0/learn/by-example/taint-checking.html. Accessed 24 November 2026.

    Chicago "Ballerina - Taint Checking." Inc, WSO2. 2022-02-14. https://ballerina.io/1.0/learn/by-example/taint-checking.html.

    APA Inc, WSO2. (2022). Ballerina - Taint Checking. Retrieved November 24, 2026, from https://ballerina.io/1.0/learn/by-example/taint-checking.html

  3. Language-based information-flow security · retrieved 2026-11-17 · rev 1371801524
    Cite this reference

    MLA "Language-based information-flow security." A. 2026-11-17. https://en.wikipedia.org/w/index.php?oldid=1371801524. Accessed 24 November 2026.

    Chicago "Language-based information-flow security." A. 2026-11-17. https://en.wikipedia.org/w/index.php?oldid=1371801524.

    APA A. (2026). Language-based information-flow security. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1371801524

  4. Edit automata: Enforcement mechanisms for run-time security policies · retrieved 2026-11-17 · rev 1371801524
    Cite this reference

    MLA "Edit automata: Enforcement mechanisms for run-time security policies." J. 2026-11-17. https://en.wikipedia.org/w/index.php?oldid=1371801524. Accessed 24 November 2026.

    Chicago "Edit automata: Enforcement mechanisms for run-time security policies." J. 2026-11-17. https://en.wikipedia.org/w/index.php?oldid=1371801524.

    APA J. (2026). Edit automata: Enforcement mechanisms for run-time security policies. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1371801524

  5. Secure information flow as a safety problem · retrieved 2026-11-17 · rev 1371801524
    Cite this reference

    MLA "Secure information flow as a safety problem." T. 2026-11-17. https://en.wikipedia.org/w/index.php?oldid=1371801524. Accessed 24 November 2026.

    Chicago "Secure information flow as a safety problem." T. 2026-11-17. https://en.wikipedia.org/w/index.php?oldid=1371801524.

    APA T. (2026). Secure information flow as a safety problem. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1371801524

  6. DBI - Database independent interface for Perl · retrieved 2020-08-28 · rev 1371801524
    Cite this reference

    MLA "DBI - Database independent interface for Perl." 2020-08-28. https://metacpan.org/pod/DBI#TaintIn. Accessed 24 November 2026.

    Chicago "DBI - Database independent interface for Perl." 2020-08-28. https://metacpan.org/pod/DBI#TaintIn.

    APA encyclopegia.org. (2020). DBI - Database independent interface for Perl. Retrieved November 24, 2026, from https://metacpan.org/pod/DBI#TaintIn

  7. Flanagan, David (1997). JavaScript: The Definitive Guide (2nd ed.). O'Reilly & Associates. p. 321. ISBN 9781565922341 . [...] the data-tainting security model is experimental in Navigator 3.0, and is not enabled by default. It is expected to be the default security model in version 4.0 of Navigator, however. Wikipedia revision 1371801524, retrieved 2026-11-18 · retrieved 2026-11-17 · rev 1371801524
    Cite this reference

    MLA "Flanagan, David (1997). JavaScript: The Definitive Guide (2nd ed.). O'Reilly & Associates. p. 321. ISBN 9781565922341 . [...] the data-tainting security model is experimental in Navigator 3.0, and is not enabled by default. It is expected to be the default security model in version 4.0 of Navigator, however. Wikipedia revision 1371801524, retrieved 2026-11-18." Flanagan, David (1997). 2026-11-17. https://en.wikipedia.org/wiki/ISBN_(identifier). Accessed 24 November 2026.

    Chicago "Flanagan, David (1997). JavaScript: The Definitive Guide (2nd ed.). O'Reilly & Associates. p. 321. ISBN 9781565922341 . [...] the data-tainting security model is experimental in Navigator 3.0, and is not enabled by default. It is expected to be the default security model in version 4.0 of Navigator, however. Wikipedia revision 1371801524, retrieved 2026-11-18." Flanagan, David (1997). 2026-11-17. https://en.wikipedia.org/wiki/ISBN_(identifier).

    APA Flanagan, David (1997). (2026). Flanagan, David (1997). JavaScript: The Definitive Guide (2nd ed.). O'Reilly & Associates. p. 321. ISBN 9781565922341 . [...] the data-tainting security model is experimental in Navigator 3.0, and is not enabled by default. It is expected to be the default security model in version 4.0 of Navigator, however. Wikipedia revision 1371801524, retrieved 2026-11-18. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/ISBN_(identifier)

  8. perlhist - the Perl history records · retrieved 2020-08-28 · rev 1371801524
    Cite this reference

    MLA "perlhist - the Perl history records." a b "perlhist - the Perl history records". 2020-08-28. https://perldoc.perl.org/perlhist.html. Accessed 24 November 2026.

    Chicago "perlhist - the Perl history records." a b "perlhist - the Perl history records". 2020-08-28. https://perldoc.perl.org/perlhist.html.

    APA a b "perlhist - the Perl history records". (2020). perlhist - the Perl history records. Retrieved November 24, 2026, from https://perldoc.perl.org/perlhist.html

  9. perlsec - Perl security · retrieved 2012-05-19 · rev 1371801524
    Cite this reference

    MLA "perlsec - Perl security." a b "perlsec - Perl security". 2012-05-19. http://perldoc.perl.org/perlsec.html. Accessed 24 November 2026.

    Chicago "perlsec - Perl security." a b "perlsec - Perl security". 2012-05-19. http://perldoc.perl.org/perlsec.html.

    APA a b "perlsec - Perl security". (2012). perlsec - Perl security. Retrieved November 24, 2026, from http://perldoc.perl.org/perlsec.html

  10. Taint checking · retrieved 2026-10-19 · rev 1371801524
    Cite this reference

    MLA "Taint checking." Wikipedia. 2026-10-19. https://en.wikipedia.org/w/index.php?oldid=1371801524. Accessed 24 November 2026.

    Chicago "Taint checking." Wikipedia. 2026-10-19. https://en.wikipedia.org/w/index.php?oldid=1371801524.

    APA Wikipedia. (2026). Taint checking. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1371801524

Cite this article

MLA

"Taint checking." encyclopegia.org, 2026, https://encyclopegia.org/wiki/taint-checking. Accessed 24 November 2026.

Chicago

"Taint checking." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/taint-checking.

APA

encyclopegia.org. (2026). Taint checking. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/taint-checking

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

Claims

PredicateValueSource
release date1989Wikipedia
CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1371801524 · 0.5 · snapshot enwiki-001371801524

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.