ArticleslgStudy

science

Session poisoning

Session poisoning is a 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 Session poisoning rather than just read about it. In short: Session poisoning (also referred to as "session data pollution" and "session modification") is a method to exploit insufficient input validation within a server application. Typically a server application that is vulnerable to this type of exploit will copy user input into session variables.

Key takeaways

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

Reference excerpt

Session poisoning (also referred to as "session data pollution" and "session modification") is a method to exploit insufficient input validation within a server application. Typically a server application that is vulnerable to this type of exploit will copy user input into session variables. The underlying vulnerability is a state management problem: shared state, race condition, ambiguity in use or plain unprotected modifications of state values. Session poisoning has been demonstrated in server environments where different, non-malicious applications (scripts) share the same session states but where usage differs, causing ambiguity and race conditions. Session poisoning has been demonstrated in scenarios where the attacker can introduce malicious scripts into the server environment, which is possible if the attacker and victim share a web host.

Origins Session poisoning was first discussed as a (potentially new) vulnerability class in the Full disclosure mailing list. Alla Bezroutchko inquired if "Session data pollution vulnerabilities in web applications" was a new problem in January 2006. However, this was an old vulnerability previously noted by others: "this is a classic state management issue" - Yvan Boily; "This is not new" - /someone. Earlier examples of these vulnerabilities can be found in major security resources/archives such as Bugtraq, e.g.

July 2001, Serious security hole in Mambo Site Server version 3.0.X by Ismael Peinado Palomo of reverseonline.com September 2005, PHP Session modification by unknown (from uw-team) and adam_i Session pollution has also been covered in some articles, such as PHP Session Security, Przemek Sobstel, 2007.

Attack examples

Trivial attack scenario An example code vulnerable to this problem is:

Session("Login") = Request("login") Session("Username") = Request("username")

Which is subject to trivial attacks such as

vulnerable.asp?login=YES&username=Mary This problem could exist in software where

User submits username / password to logon.asp If password for Mary checks out, logon.asp forwards to vulnerable.asp?login=YES&username=Mary The problem is that vulnerable.asp is designed on the assumption that the page is only accessed in a non-malicious way. Anyone who realizes how the script is designed, is able to craft an HTTP request which sets the logon user arbitrarily.

Exploiting ambiguous or dual use of same session variable Alla Bezroutchko discusses a scenario where $_SESSION['login'] is used for two different purposes.

In the login scripts, the session variable stores "This user is logged on". In the password reset scripts, the session variable stores "this user wants his password reset". A race condition was demonstrated, in which the reset scripts could be exploited to change the logged on user arbitrarily.

Exploiting scripts allowing writes to arbitrary session variables Alla Bezroutchko discusses examples observed in development forums, which allows writing to arbitrary session variables. The first example is

(in which $_GET["something"] is probably from a selection box or similar). Attack becomes

vulnerable.php?something=SESSION_VAR_TO_POISON

Session poisoning attacks enabled by php.ini: register_globals = on php.ini: register_globals = on is known to enable security vulnerabilities in several applications. PHP server administrators are recommended to disable this feature. Note: Real-world examples of session poisoning in enabled by register_globals = on was publicly demonstrated in back in July 2001 article Serious security hole in Mambo Site Server version 3.0.X. Second example by /someone is

which is vulnerable if:

It is possible for attacker to cause both conditions to be false. php.ini is misconfigured (register_globals = on), which allows $var default value to be controlled by GPC (GET, POST, or COOKIE) input. Attack becomes

vulnerable.php?var=SESSION_VAR_TO_POISON

Exploit utilizing a shared PHP server (e.g. shared web hosting) 'unknown' of uw-team.org discusses a scenario where attacker and victim shares the same PHP server. Attack is fairly easy:

The attacker first visits the victim's page, and e.g. log on. Attacker then uploads a PHP script to his account, and has it display context of $_SESSION (set by victim script). Attacker determines which variable needs to be changed, uploads a script which sets this variable, executes it. Attacker visits victim pages to see if anticipated exploit worked. This attack only requires that victim and attacker share the same PHP server. The attack is not dependent on victim and attacker having the same virtual hostname, as it is trivial for attacker to move the session identifier cookie from one cookie domain to another.

See also Session fixation

References

Worked examples

Example 1 — a first encounter with Session poisoning

Start with the simplest possible case. Write down what Session poisoning claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In 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 Session poisoning 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 Session poisoning 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 Session poisoning

In research
Session poisoning appears in 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 Session poisoning 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
Session poisoning is common in secondary-school and first-year university syllabi. It links to neighbouring topics Client-side web security exploits, Web security exploits, so understanding it makes those chapters shorter.
In everyday life
Look for Session poisoning 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 “Session poisoning” →

How to study Session poisoning in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Session poisoning 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 Session poisoning out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Session poisoning in simple terms?

Session poisoning (also referred to as "session data pollution" and "session modification") is a method to exploit insufficient input validation within a server application. Typically a server application that is vulnerable to this type of exploit will copy user input into session variables.

Why does Session poisoning matter?

Because it connects several 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 Session poisoning?

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 Session poisoning.

Tags

  • Client-side web security exploits
  • Web security exploits

Keep exploring