SH3 Public Management System Stored User Credentials Using a Reve
The SH3 Public Management System stored user passwords using a reversible XOR operation with a fixed key embedded in the application, rather than a salted one-way hash. An attacker with read access to the relevant database tables or backups could recover user passwords in plaintext.
Pentesting
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
SH3 Sistemas publishes the SH3 Public Management System, software used by public-sector bodies. The vulnerability described here, tracked as CVE-2026-116054, affects the SIAM and ARC modules in SH3 versions prior to 2026.0.2.0. It is classified as CWE-257, Storing Passwords in a Recoverable Format.
The feature at issue is authentication: the product stores user credentials in database fields tied to user login. In a correct design, a password is passed through a salted one-way hashing function, so the stored value cannot be turned back into the password. In the affected SH3 versions, the stored credential material was instead produced by a reversible byte-by-byte XOR operation using a fixed key embedded in the application logic. Anyone with read access to the relevant database tables or backups could therefore recover the original passwords in plaintext.
The finding came out of an authorised internal security assessment for a municipal public-sector client, with the SH3 system inside the authorised scope. It was treated as a product-level vulnerability rather than a local misconfiguration, because the credential storage mechanism is implemented by the SH3 application itself. The vendor was notified and the issue was fixed; the fix was released in September 2026 as a manual update.
Setup
The assessment was performed against a SH3 installation in a government office, with authorised read access to the database environment obtained through another assessment vector. The database is Firebird. The credential field identified during the assessment is STR_SH_USR, present in the affected user tables. The report disclosed to the vendor describes the affected storage locations as USUARIOS/siam.gdb and USUARIO/arc.gdb.
The work relied on known password and stored-value pairs, with passwords obtained through other vectors during the assessment; some weak passwords and a default account whose username and password were the same made key recovery easier. These known pairs are what made key recovery possible. The report does not list the tools used beyond querying the Firebird catalogue.
Finding it
The vulnerable field was found during database enumeration. After obtaining authorised read access, the researcher searched Firebird metadata for tables and fields related to users and authentication. The internal Firebird catalogue was queried to locate candidate authentication tables, which led to the USUARIOS table for the management module and the USUARIO table for the tax/collection module. Inspecting the columns revealed STR_NM_USR, used as the login identifier, and STR_SH_USR, used to store the password material.
The first sign that STR_SH_USR was not a real password hash was the relationship between password length and stored value length. Values in STR_SH_USR had different lengths: short passwords produced short stored values, and longer passwords produced longer stored values. A hash produces a fixed-length output regardless of input length, so this alone was suspicious.

The second sign came from byte-level comparison. When a password obtained through another vector during the assessment was compared against its corresponding stored value, the difference between the two followed a simple positional pattern. For each byte position i, the relationship observed was:
key[i] = password[i] XOR stored_value[i]
That is the signature of a reversible XOR transformation rather than a hash.

Exploitation
Step 1: Confirm the XOR pattern
Comparing a known plaintext password with its stored value byte by byte showed that each position differed by a constant per-position value. The relationship key[i] = password[i] XOR stored_value[i] held across the compared bytes, which confirmed a XOR-based reversible transformation and meant the stored value was effectively ciphertext under a repeating key.
Step 2: Recover key bytes from known pairs
With the pattern confirmed, the researcher analysed other known password and stored-value pairs. Each known plaintext revealed the key bytes at the positions it covered. Weak passwords and a default account (same username and password) made this step easier, because those plaintexts were already known or trivially guessable.

Step 3: Assemble the 32-byte key and validate it
Enough known pairs yielded a complete 32-byte key. The researcher then validated the recovered key using the reversible nature of XOR: applying the same operation with the recovered key to stored values reproduced the known plaintext passwords.

Step 4: Decode the full user set
The original report reconstructed the password recovery operation as a repeated XOR between the stored credential bytes and the fixed key embedded in the application. For public disclosure, the actual key and real credential samples are omitted:
STATIC_KEY = b"<fixed-embedded-key>"def decode_password(stored_value: bytes, key: bytes = STATIC_KEY) -> bytes: return bytes( byte ^ key[index % len(key)] for index, byte in enumerate(stored_value) )
The function walks the stored bytes and XORs each one with the key byte at index % len(key), which is the repeating-key operation observed in the byte comparisons. Because XOR is its own inverse, the same routine both produces and reverses the stored value.
The private report demonstrated the recovery using known plaintext/ciphertext pairs and then applied the reconstructed transformation to the full tested user set. The key was reconstructed from known accounts, and the same operation was applied to all 82 accounts in the tested SIAM database, recovering valid plaintext passwords without brute force.
Root cause
The application did not apply a cryptographic password hash to user passwords. Instead it transformed them with a reversible byte-by-byte XOR using a fixed key embedded in the application logic. The same fixed key was reused across accounts and was not derived from an installation-specific secret, so the mechanism provided no meaningful protection once the stored credential values and the transformation logic were accessible. Because XOR is reversible, knowing the key is enough to recover every password.
The stored values used no salted one-way hash and no installation-specific secret, so they were not resistant to anyone with read access to the tables or backups. The report does not describe any additional controls around the credential field.
Impact
An attacker with read access to the relevant database tables or backups could recover user passwords in plaintext. In the tested SIAM database this covered all 82 accounts, recovered without brute force. The affected modules are SIAM and ARC, and the affected versions are those prior to 2026.0.2.0. The exposure depends on the attacker first obtaining read access to the database environment or a backup; the weakness itself is in how the product stores credentials, not in how access is granted.
Fix
The vendor was notified and the issue was fixed. The fix is available in SH3 versions from 2026.0.2.0 onward, released in September 2026, and requires a manual update. The report does not describe the technical content of the fix. The correct direction is to stop storing credentials in a recoverable form and use a salted one-way password hashing function instead, so that stored values cannot be reversed even if the database is read.
Variants to test
- Length correlation on credential fields. Compare the length of stored credential values against known password lengths. A positive result is stored values whose length tracks the plaintext length rather than being fixed per algorithm.
- Byte-difference analysis with a known pair. Take one account whose password you know and XOR it against the stored value position by position. A positive result is a constant per-position difference, indicating a repeating-key XOR rather than a hash.
- Key recovery from weak or default accounts. Look for default accounts where username equals password, or other guessable credentials, and use them to reveal key bytes. A positive result is enough recovered bytes to decode other accounts.
- Bulk decode after key recovery. Apply the recovered transformation to every stored value in the table. A positive result is valid plaintext passwords for accounts you did not already know, recovered without brute force.
- Firebird catalogue enumeration. Query the internal catalogue for tables and columns related to users and authentication, looking for fields such as login identifiers alongside suspicious credential columns. A positive result is a credential column whose contents behave like reversible ciphertext.
What happened, in plain words
A security researcher was hired to test the security of a piece of software used by a government office. The software is called the SH3 Public Management System, made by a company called SH3 Sistemas. It is a public management system used by a government office. The researcher was allowed to look at it, and while doing so found a serious problem in how the program keeps users' passwords.
Normally, when a website or program stores your password, it does not keep the password itself. It runs the password through a mathematical recipe called a hash that scrambles it into a long string of characters. The important part is that this scrambling only works one way: you can turn a password into the scrambled value, but you cannot turn the scrambled value back into the password. When you log in later, the program scrambles what you typed and compares the two scrambled values. If they match, you are in. Even if someone steals the whole database, they only get the scrambled values, which are useless on their own.
In the affected versions of SH3, that is not what happened. The program took each password and scrambled it with a much simpler trick called XOR, using a secret key that was baked into the program itself. XOR is reversible: if you know the key, you can undo the scrambling and get the original password back. So anyone who could read the database, or a backup of it, could recover every user's password in plain text.
The researcher found this during an authorised security assessment for a municipal public-sector client. The SH3 system was part of the agreed scope. The problem was treated as a flaw in the product itself, not a one-off mistake in that particular installation, because the credential storage mechanism is built into the SH3 application. The vendor was notified and the issue was fixed. The fix was released in September 2026 and requires a manual update.
The vulnerability is tracked as CVE-2026-116054. A CVE is a public identifier given to a known security flaw so that people can refer to it unambiguously. It is classified as CWE-257, which is a category name meaning "Storing Passwords in a Recoverable Format". CWE is a catalogue of weakness types, a bit like a library classification system for security bugs.

The product and the feature involved
The feature at issue is authentication: the part of the program that checks who you are when you log in. To do that, the program has to store something about each user's password in its database. A database is an organised collection of tables, a bit like a set of spreadsheets, where each row is a record and each column is a field. The SH3 program keeps user records in tables, and one of the columns in those tables holds the password material.
In a correct design, that column would hold a salted one-way hash. A salt is a random value added to each password before hashing, so that two users with the same password end up with different stored values. A one-way function is a recipe that is easy to run forwards but practically impossible to reverse. Neither of those was in place here. Instead, the stored value was produced by a reversible byte-by-byte XOR operation using a fixed key embedded in the application logic. Byte means one unit of data, roughly one character's worth; XOR is a simple logical operation on bits that has the useful property of being its own inverse.
Because the same fixed key was reused across all accounts and was not derived from anything specific to the installation, the mechanism gave no real protection once someone had both the stored values and the transformation logic. Anyone with read access to the relevant database tables or backups could recover the original passwords in plain text.
Setting the scene
The assessment was performed against a SH3 installation in a government office. The researcher had authorised read access to the database environment, obtained through another assessment vector. In plain terms, they had permission to look inside the database, and they had got there by a route that was itself part of the agreed testing.
The database is Firebird, which is a particular brand of database software. Firebird, like most databases, keeps an internal catalogue: a set of system tables that describe all the other tables and columns in the database. Think of it as the index at the back of a book, telling you what is where. Querying that catalogue is how you find out which tables exist and what columns they have.
The credential field identified during the assessment is STR_SH_USR, present in the affected user tables. The report disclosed to the vendor describes the affected storage locations as USUARIOS/siam.gdb and USUARIO/arc.gdb. Those are file names: .gdb is the file extension Firebird uses for a database file, and the names suggest one database for the management module and one for the tax/collection module.
The work relied on known password and stored-value pairs, with passwords obtained through other vectors during the assessment; some weak passwords and a default account whose username and password were the same made key recovery easier. A known pair here means you know both the original password and the scrambled value stored for it. That is the key to the whole attack, because if you know both ends you can work out what happened in between. The report does not list the tools used beyond querying the Firebird catalogue.
Finding it
The vulnerable field was found during database enumeration. Enumeration just means listing things out systematically: going through the database and asking "what tables are here, what columns does each one have?". After obtaining authorised read access, the researcher searched Firebird metadata for tables and fields related to users and authentication. The internal Firebird catalogue was queried to locate candidate authentication tables, which led to the USUARIOS table for the management module and the USUARIO table for the tax/collection module. Those names are Portuguese for "users".
Inspecting the columns revealed STR_NM_USR, used as the login identifier, and STR_SH_USR, used to store the password material. The first is the username, the second is the scrambled password.
The first sign that STR_SH_USR was not a real password hash was the relationship between password length and stored value length. Values in STR_SH_USR had different lengths: short passwords produced short stored values, and longer passwords produced longer stored values. A hash produces a fixed-length output regardless of input length, so this alone was suspicious. If you hash a one-letter password and a hundred-letter password with the same algorithm, you get the same number of characters out both times. Here, the length of the stored value tracked the length of the password, which means the stored value was carrying the password's shape through.

The second sign came from byte-level comparison. When a password obtained through another vector during the assessment was compared against its corresponding stored value, the difference between the two followed a simple positional pattern. For each byte position i, the relationship observed was:
key[i] = password[i] XOR stored_value[i]
Let us unpack that line. password[i] means the byte at position i in the password, and stored_value[i] means the byte at the same position in the stored value. XOR is a logical operation: for each bit, the result is 1 if the two input bits differ and 0 if they are the same. The line says: if you XOR the password byte with the stored byte at the same position, you get a value that is constant for that position. That constant is the key byte at that position. In other words, the stored value is the password with a repeating key XORed over it, which is exactly what a simple cipher looks like. That is the signature of a reversible XOR transformation rather than a hash.

Exploitation
Step 1: Confirm the XOR pattern
Comparing a known plaintext password with its stored value byte by byte showed that each position differed by a constant per-position value. The relationship key[i] = password[i] XOR stored_value[i] held across the compared bytes, which confirmed a XOR-based reversible transformation and meant the stored value was effectively ciphertext under a repeating key. Plaintext means the readable original, ciphertext means the scrambled version. A repeating key means the same short key is used over and over, wrapping around, to scramble a longer message.
Why do this step? Because before you can decode anything, you need to be sure of the mechanism. One pair matching the pattern could be a coincidence; checking it across many bytes confirms it.
Step 2: Recover key bytes from known pairs
With the pattern confirmed, the researcher analysed other known password and stored-value pairs. Each known plaintext revealed the key bytes at the positions it covered. Weak passwords and a default account (same username and password) made this step easier, because those plaintexts were already known or trivially guessable.
Think of it like a crossword: each known pair fills in some of the squares of the key. A short password fills in the first few positions; a longer one fills in more. A default account where the username and password are the same is especially useful, because you do not need to guess anything: you already know what the password is.

Step 3: Assemble the 32-byte key and validate it
Enough known pairs yielded a complete 32-byte key. The researcher then validated the recovered key using the reversible nature of XOR: applying the same operation with the recovered key to stored values reproduced the known plaintext passwords. Validation matters because a key that is almost right will produce almost-readable output; you want to be sure every byte is correct before you trust it on accounts you have not seen.

Step 4: Decode the full user set
The original report reconstructed the password recovery operation as a repeated XOR between the stored credential bytes and the fixed key embedded in the application. For public disclosure, the actual key and real credential samples are omitted:
STATIC_KEY = b"<fixed-embedded-key>"def decode_password(stored_value: bytes, key: bytes = STATIC_KEY) -> bytes: return bytes( byte ^ key[index % len(key)] for index, byte in enumerate(stored_value) )
Line by line, in plain words:
STATIC_KEY = b"<fixed-embedded-key>"sets up the key as a sequence of bytes. Thebprefix means "this is bytes, not text". The placeholder<fixed-embedded-key>stands in for the real key, which is not published.def decode_password(stored_value: bytes, key: bytes = STATIC_KEY) -> bytes:defines a function calleddecode_passwordthat takes the stored value and, optionally, a key. If no key is given, it uses the static one. The-> bytespart says it returns bytes.return bytes(starts building the output as a sequence of bytes.byte ^ key[index % len(key)]is the core: for each byte in the stored value, XOR it with a byte from the key.index % len(key)means "take the position in the stored value, divide by the key length, and keep the remainder". That remainder wraps around from 0 to the key length minus 1 and then back to 0, which is how the key repeats over a longer message.for index, byte in enumerate(stored_value)walks through the stored value one byte at a time, keeping track of the position (index) and the byte itself.- The closing
)finishes thebytes(...)call.
The function walks the stored bytes and XORs each one with the key byte at index % len(key), which is the repeating-key operation observed in the byte comparisons. Because XOR is its own inverse, the same routine both produces and reverses the stored value. That is the crucial property: if you XOR something twice with the same key, you get back the original. So the same function that would have scrambled a password can unscramble it.
The private report demonstrated the recovery using known plaintext/ciphertext pairs and then applied the reconstructed transformation to the full tested user set. The key was reconstructed from known accounts, and the same operation was applied to all 82 accounts in the tested SIAM database, recovering valid plaintext passwords without brute force. Brute force means trying every possible password until one works; here, no guessing was needed at all, because the key did the work.
Root cause
The application did not apply a cryptographic password hash to user passwords. Instead it transformed them with a reversible byte-by-byte XOR using a fixed key embedded in the application logic. The same fixed key was reused across accounts and was not derived from an installation-specific secret, so the mechanism provided no meaningful protection once the stored credential values and the transformation logic were accessible. Because XOR is reversible, knowing the key is enough to recover every password.
The stored values used no salted one-way hash and no installation-specific secret, so they were not resistant to anyone with read access to the tables or backups. The report does not describe any additional controls around the credential field.
Impact
An attacker with read access to the relevant database tables or backups could recover user passwords in plain text. In the tested SIAM database this covered all 82 accounts, recovered without brute force. The affected modules are SIAM and ARC, and the affected versions are those prior to 2026.0.2.0. The exposure depends on the attacker first obtaining read access to the database environment or a backup; the weakness itself is in how the product stores credentials, not in how access is granted.
In everyday terms: if someone gets hold of the database file, or a backup of it, they do not need to break any encryption. They can read the passwords directly.
Fix
The fix is available in SH3 versions from 2026.0.2.0 onward, released in September 2026, and requires a manual update. The report does not describe the technical content of the fix. The correct direction is to stop storing credentials in a recoverable form and use a salted one-way password hashing function instead, so that stored values cannot be reversed even if the database is read.
Variants to test
If you are testing similar software, these are the checks that would reveal the same class of problem:
- Length correlation on credential fields. Compare the length of stored credential values against known password lengths. A positive result is stored values whose length tracks the plaintext length rather than being fixed per algorithm.
- Byte-difference analysis with a known pair. Take one account whose password you know and XOR it against the stored value position by position. A positive result is a constant per-position difference, indicating a repeating-key XOR rather than a hash.
- Key recovery from weak or default accounts. Look for default accounts where username equals password, or other guessable credentials, and use them to reveal key bytes. A positive result is enough recovered bytes to decode other accounts.
- Bulk decode after key recovery. Apply the recovered transformation to every stored value in the table. A positive result is valid plaintext passwords for accounts you did not already know, recovered without brute force.
- Firebird catalogue enumeration. Query the internal catalogue for tables and columns related to users and authentication, looking for fields such as login identifiers alongside suspicious credential columns. A positive result is a credential column whose contents behave like reversible ciphertext.
Glossary
- Authentication: the process of checking who a user is when they log in.
- Backup: a copy of data kept so it can be restored if the original is lost or damaged.
- Brute force: trying every possible password or key until one works.
- Byte: a unit of data, roughly one character's worth.
- Ciphertext: data that has been scrambled so it cannot be read without the key.
- Column: a field in a database table, like a column in a spreadsheet.
- CVE: a public identifier for a known security vulnerability.
- CWE: a catalogue of weakness types used to classify security bugs.
- CWE-257: the category "Storing Passwords in a Recoverable Format".
- Database: an organised collection of data, usually in tables.
- Enumeration: systematically listing things out, such as tables and columns in a database.
- Firebird: a brand of database software.
- Hash: a one-way mathematical recipe that turns data into a fixed-length scrambled value.
- Key: a secret value used to scramble and unscramble data.
- Known pair: a case where you know both the original value and its scrambled form.
- One-way function: a recipe that is easy to run forwards but practically impossible to reverse.
- Plaintext: readable, unscrambled data.
- Repeating key: a short key used over and over, wrapping around, to scramble a longer message.
- Salt: a random value added to a password before hashing so that identical passwords produce different stored values.
- Table: a set of records in a database, like a spreadsheet.
- XOR: a logical operation on bits that is its own inverse, so applying it twice with the same key returns the original data.