ArticleslgStudy

computer science

Suhosin

Suhosin is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Suhosin rather than just read about it. In short: Suhosin (Korean: 수호신, Korean pronunciation: [suɦoɕin], meaning "guardian angel") is an open source patch for PHP and also a PHP extension, written by the German company Sektion Eins. The patch and the extension are two independent parts, that can be used separately or in combination. "The goal behind Suhosin is to be a safety net that protects servers from insecure PHP coding practices." Suhosin also reduces the "at…

Key takeaways

  • Suhosin belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Suhosin to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Suhosin from memory before moving on to harder problems.

Reference excerpt

Suhosin (Korean: 수호신, Korean pronunciation: [suɦoɕin], meaning "guardian angel") is an open source patch for PHP and also a PHP extension, written by the German company Sektion Eins. The patch and the extension are two independent parts, that can be used separately or in combination. "The goal behind Suhosin is to be a safety net that protects servers from insecure PHP coding practices." Suhosin also reduces the "attackable surface" that PHP adds to a Web Server through function whitelists, resource limits, transparent session and cookie encryption, binary content filter, logging and various other protections. This reduces the risk of deploying previously deemed unsafe PHP programs and protects against known and unknown attacks.

Features While the original patch included several low-level memory-related hardenings, those features are not present in the modules, but most of them have been upstreamed into PHP.

Cookies encryption: to mitigate XSS-based cookies stealing, the cookies are encrypted, so an attacker could not get their values, and they are tied to the user-agent and part of the IP address of the user, making a stolen cookie unusable by the attacker. Inclusion protection: Uploaded and remote files cannot be included, mitigating arbitrary file inclusion attacks. Disabling common code execution vectors: the eval keyword is not a real function in PHP, thus it cannot be disabled with the disable_function directive, but Suhosin added this possibility, and also allowing to disable the infamous /e operator for the preg_replace function that can lead to arbitrary code execution. Protection against infinite recursion: PHP has a documented behavior of yielding a segmentation fault error upon infinite recursion. Since this is a memory-safety issue, Suhosin will make the application gracefully exit once a maximum level of recursion has been met. Granular function white/black-list: the disabled_function directive of PHP is not granular at all, Suhosin provides a white and black-list mechanism for functions, on a per virtual-host and folder basis. Black-list against sensitive variable names: Suhosin will drop GET, POST, COOKIE variables with global reserved variable names following names, like GLOBALS, _COOKIE, _ENV, _FILES, _GET, _POST,… File upload hardening: Suhosin supports calling scripts upon file-upload, allowing things like automatic anti-virus scanning upon upload. It can also prevent ELF files, binary files,… Custom actions upon violation: blocking violating variables, send a specific HTTP response code, issue a redirection or even execute another PHP script. Extensive logging: multiple log devices, logging offending filename and the line number, the IP address of the attacker, even behind reverse proxies.

Distribution with operating systems In some Linux distributions, notably Debian in versions up to 6.x ("Squeeze") and Gentoo Linux, it was shipped by default with both patch and extension. Suhosin was removed from Debian as of version 7 (Wheezy) but reappeared in the current development branch. It is activated by default in Mac OS X Server. As of PHP 5.4, openSUSE dropped the Suhosin patch, but maintains a port of the Suhosin extension. FreeBSD 10.1 maintains the Suhosin extension in its ports collection.

Development history and legacy Suhosin was first released in 2006, and targeted PHP 5.2.0. The last release of the hardening patch happened a couple of months after the release of the module. The last news article on the official website is from 2007, and no activity occurred in the code repository from May 2012 until February 2014. This led some distributions to consider the Suhosin project dead, until some people from the community started to contribute back to it, circa 2014. There is no plan to upstream features into PHP. In November 2015, suhosin7 was created, to provide similar hardening features to PHP7 but failed to gain momentum among the community. The Snuffleupagus project aims at being its successor, for PHP7 and onwards.

References

External links Official website Suhosin on GitHub

Worked examples

Example 1 — a first encounter with Suhosin

Start with the simplest possible case. Write down what Suhosin claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Suhosin before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Suhosin ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Suhosin

In research
Suhosin appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Suhosin in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Suhosin is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer security software, PHP, so understanding it makes those chapters shorter.
In everyday life
Look for Suhosin outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Suhosin” →

How to study Suhosin in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Suhosin means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Suhosin out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Suhosin in simple terms?

Suhosin (Korean: 수호신, Korean pronunciation: [suɦoɕin], meaning "guardian angel") is an open source patch for PHP and also a PHP extension, written by the German company Sektion Eins. The patch and the extension are two independent parts, that can be used separately or in combination. "The goal behi…

Why does Suhosin matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Suhosin?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Suhosin.

Tags

  • Computer security software
  • PHP

Keep exploring