CSEC3616Cybersecurity Engineering

    Middleware, databases and browsers

    How access control extends into middleware, databases and the browser, and why the same-origin policy alone does not stop the confused deputy problem.

    • Name the technologies the lecture lists under middleware access control, and explain why distribution makes them hard to secure.
    • Explain how database access control maps operating-system users to roles, and why OS-level protection still matters underneath it.
    • State the same-origin policy and explain why it does not stop the browser confused deputy problem.
    • Walk through the three-step XSS version of the confused deputy problem the lecture uses.

    14 min read

    Intuition

    Access control does not stop at the operating system. A request to view accounting data might pass through a message broker, then into a database engine, then out through a web page rendered in a browser, and each of those layers makes its own access decision, on its own model, before the operating system ever sees the request. The further data travels from the machine it started on, the harder it gets to say who should be allowed to touch it.

    Mechanism

    Middleware is the software that connects components, whether on one host or across several: message brokers such as AMQP, and remote procedure call systems such as Java RMI, CORBA and XML-RPC. Distribution is what makes its access control difficult. A middleware component has to define its permissions at the right granularity, keep track of who currently holds which right, and enforce that continuously, across machines that do not share one administrator. Policy languages exist to write these rules down, but the lecture is blunt about them: they are hard to use correctly, and a rule nobody can read correctly is a rule nobody can audit correctly either.

    Middleware is also exposed. Because it usually has to talk across a network, it can be probed from outside. Restricting it to internal traffic closes off random, remote exploitation, but it does nothing against malware that starts inside one of the systems the middleware connects and works outward from there.

    Threat

    A middleware component reachable from outside a trusted network can be probed and attacked by anyone who can reach it, without ever touching the operating systems at either end.

    Control

    Keeping middleware off external networks closes the easiest attack path: random, remote scanning and exploitation. It does not close the internal one. Malware that starts on any system the middleware connects can still reach it and attack it from inside the trust boundary.

    Mechanism

    Database access control layers on top of this. A database management system that supports multiple users and processes runs its own access control, separate from the operating system’s. Connecting still requires a username and password, authentication first, the same as everywhere else in this module, and the DBMS then runs its own internal privilege system, typically by mapping operating-system accounts onto roles defined inside the database rather than managing every user’s rights one at a time.

    The SQL standard defines access control down to a fine grain: in principle, almost any object inside the database can be individually controlled. That precision has a cost. A system with that many controllable objects is easy to specify into something too complicated to manage correctly. The DBMS also runs its own integrity checks on the data it holds, and those checks are accurate but computationally heavy to run.

    None of this replaces the operating system’s own protections. A database’s rows and tables are, physically, files on disk or pages in RAM, and an attacker who bypasses the DBMS and reads those files directly bypasses every role and permission the database defined.

    Exam detail

    Two separate costs to remember here. SQL’s fine-grained model can be over-specified into something too complex to manage. Its integrity controls are accurate but computationally expensive to check. Neither problem solves the other: a simpler policy does not make integrity checking cheaper, and faster checking does not make a sprawling policy easier to audit.

    Mechanism

    Browsers are a third middleware layer, and the one every user interacts with directly. The core access control rule is the same-origin policy: active content such as JavaScript may only communicate back to the origin it was loaded from. Code on a page runs inside a sandbox, a restricted environment meant to stop it altering the host system outside the browser. Chrome goes further and runs each tab in its own operating-system process, so a script that hangs one tab does not take the whole browser down with it.

    Mechanism

    The same-origin policy checks where code was loaded from, not who wrote it. That gap is what makes the confused deputy problem possible in a browser. A privileged program is asked to do something, and does it with its own authority rather than the authority of whoever actually asked. That is the confused deputy problem, and in a browser the deputy is the browser itself.

    The lecture walks through it as cross-site scripting, in three steps. A user visits a trusted site that has an XSS vulnerability, and the attacker has already injected a malicious script into it. When the user’s browser loads the page, the injected script runs as if it were the site’s own code, with the site’s permissions rather than the attacker’s. The script then acts with the site’s authority, sending authenticated requests or reading sensitive data, because the browser believes those actions genuinely come from the site it trusts.

    The confused deputy problem via XSS1 — injects a malicious script2 — user visits; script runs as the site3 — acts with the site’s authorityAttackerTrusted site(has an XSS flaw)Victim's browserthe confused deputySensitive actione.g. an authenticated request
    the deputy — acts with authority that is not its own to give awayattacker-controlled step

    A privileged program is asked to do something and does it with its own authority rather than the requester's. That is the confused deputy problem. In the browser, the deputy is the victim's own browser: once an attacker gets a script injected into a trusted site (an XSS flaw), the browser runs that script as if it came from the site, because the same-origin policy only checks where the code loaded from, not who actually wrote it. The script then acts with the site's session and cookies, not the attacker's own — the trusted site's deputy has been confused about who it is really acting for. (source: Week 3 notes §4.2)

    Threat

    Once an attacker’s script is running inside a trusted site’s origin, the same-origin policy protects it exactly as if it were the site’s own code. The browser carries out the script’s requests using the site’s session and cookies, because it has no way to tell the code was not written by the site it loaded from.

    Control

    The browser sandbox stops the injected script from reaching outside the browser onto the host machine. It does not stop the confused deputy problem itself: the sandbox limits what the script can do to the computer, not what it can do with the site’s own authority inside the browser, which is exactly the channel XSS abuses. Chrome’s per-tab process isolation limits how far a compromised tab affects the rest of the browser, but that is containment, not a fix for the underlying trust gap. Week 3 leaves the actual defences against XSS itself to the web security lecture.

    Pitfall

    Do not describe the confused deputy problem as the browser being hacked. Nothing needs to compromise the browser at all. The browser is doing exactly what it is designed to do, run the site’s code with the site’s authority, and the problem is that the code running is not really the site’s.

    Recall

    Why doesn't the same-origin policy stop the XSS version of the confused deputy problem?

    Because it checks where the code was loaded from, not who wrote it. An attacker’s script injected into a trusted page loads from that page’s own origin, so the same-origin policy treats it exactly like the site’s own code.

    Aside

    The lecture notes how the same protection gets undermined at scale. Pages loaded with trackers from many ad networks already make the same-origin policy’s intent look thin, and an attacker can even launder an origin by wrapping a target site in a proxy such as a translation service, so a victim’s browser sees a trusted-looking origin around content the attacker actually controls. This is scene-setting for the web security lecture, not a tested fact on its own.