Distributed computation is about time and state. That is, in order for more than one component to communicate, state must be shared, and all that takes time.
Most programmers anthropomorphize their work. They think about one thread of control carrying out the entire program in the same way they would if they had to do the job themselves. Modern computers, however, switch between tasks very quickly, and in multi-core, multi-CPU, or distributed systems, two events may take place at exactly the same time. Defects rush to fill the gap between the programmer's model of how a program executes and what happens in reality. These defects are related to unexpected interactions between threads, processes, time, and information. These interactions happen through shared state: semaphores, variables, the file system, and, basically, anything that can store information.
public class GuestBook extends HttpServlet {
String name;
protected void doPost (HttpServletRequest req, HttpServletResponse res) {
name = req.getParameter("name");
...
out.println(name + ", thanks for visiting!");
}
}
Dick
" to name
Jane
" to name
Jane, thanks for visiting!
"Jane, thanks for visiting!
"
public class ConnectionManager {
private static Connection conn = initDbConn();
...
}
AuthnRequest
, InResponseTo
attributes and a unique ID for SAML Assertion
might be susceptible to replay attacks.AuthnRequest
element ID
attribute. The identity provider should return this ID
value in the attribute InResponseTo
. This enables the service provider to keep track of the state for unique requests. Additionally, each Assertion
in the SAML response is also identified by a unique ID. Failure to follow this mechanism can leave SAML responses susceptible to replay attacks. IssueInstant
, NotOnOrAfter
, and NotBefore
attributes. Ideally, the value for these attributes allows the messages to be valid for one to five minutes. An attacker with access to a SAML Response message before it expires can successfully replay it to authenticate into the application if the identity provider fails to set reasonable expiration time or if the service provider does not honor the expiration time. Conditions
element as part of the assertion as shown in the following example:
<Conditions NotBefore="2019-09-23T19:35:09.949Z" NotOnOrAfter="2019-09-23T20:35:09.949Z">
<AudienceRestriction>
<Audience>https://exampleSP/metadata/</Audience>
</AudienceRestriction>
</Conditions>
<http auto-config="true">
...
<session-management session-fixation-protection="none"/>
</http>
Example 1
, the attacker does this through an obvious direct method that does not suitably scale for attacks involving less well-known web sites. However, do not be lulled into complacency; attackers have many tools in their belts that help bypass the limitations of this attack vector. The most common technique attackers use involves taking advantage of cross-site scripting or HTTP response splitting vulnerabilities in the target site [1]. By tricking the victim into submitting a malicious request to a vulnerable application that reflects JavaScript or other code back to the victim's browser, an attacker can create a cookie that causes the victim to reuse a session identifier controlled by the attacker.bank.example.com
and recipes.example.com
, a vulnerability in one application can enable an attacker to set a cookie with a fixed session identifier that is used in all interactions with any application on the domain example.com
[2].use_strict_mode
attribute for session cookies.
ini_set("session.use_strict_mode", "0");
<form method="POST" action="j_security_check">
<input type="text" name="j_username">
<input type="text" name="j_password">
</form>