A short white box code audit of avo
The audit found a stored cross-site scripting issue in HTML-based content fields and a potentially critical flaw in handling polymorphic resources. An attacker could hijack visitors' or administrators' browsers, and the polymorphic issue could lead to unsafe reflection or partial denial of service.
Published on evait.medium.com
We conducted a two-day penetration test on the product “Avo”, which is a Ruby / Ruby on Rails gem for building administrative interfaces. Since greenhats®, our platform, uses this software for some production environments, it is enforced by internal policy to perform a small pentest / white box code audit to identify…
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
Avo is a Ruby / Ruby on Rails gem for building administrative interfaces. The target of this audit was the product at version 3.0.0.pre12. The greenhats platform uses Avo for some production environments, and internal policy requires a small penetration test or white box code audit to identify obvious potential risks before such software is relied on. The authors are explicit that this is not a comprehensive penetration test: for an application of this type and size, a full engagement should be scheduled for at least two weeks. The audit was a two-day effort.
The report and the test itself are a public community contribution from greenhats to the Avo project. Because the findings have a critical impact on the security of Avo users, the authors state that findings would be released only after confirming they were fixed in all of Avo's latest release channels and after users were notified that they must update. The report notes that v2.33.3 contains fixes for both vulnerabilities.
Two CVEs came out of the work:
- CVE-2023-34102, credited to FLX | Paul Werther
- CVE-2023-34103, credited to Mys7ic | Anton Strilez
Two GitHub advisories accompany them: "Possible unsafe reflection / partial DoS" (GHSA-86h2-2g4g-29qx) and "Stored XSS (Cross Site Scripting) in html content based fields" (GHSA-5cr9-5jx3-2g39). The full penetration test report is published as a PDF titled "Penetration test report, Avo v3.0.0.pre12-2023".
Setup
The entire code base of Avo in version 3.0.0.pre12 was audited using both automated and manual techniques. In addition, the authentication and authorisation parts were manually audited. No specific accounts, roles, tools or deployment configuration are described beyond this.
The authors note that Ruby on Rails itself contains many best practices for security implementations and greatly reduces the risk and potential of common vulnerabilities. In particular, the use of standard Active Record functions and an external, well-known gem for all search operations makes it more difficult to find typical vulnerabilities. This framing matters for reading the findings: the framework raised the bar, and the issues that surfaced were in Avo's own handling of content and resources rather than in generic query construction.
Finding it
Two issues were identified.
- A bug in the displaying functionality of HTML-based content that could lead to hijacking of visitors' or other administrators' browsers. The advisory title names stored XSS in html content based fields.
- A potentially critical security issue in the handling of polymorphic resources. The associated advisory is titled "Possible unsafe reflection / partial DoS".
The authors state that, due to time constraints, they do not provide full exploitation of either finding. Their position is that applying security mitigations even for potential vulnerabilities should be the main goal of a white box code audit, rather than spending too much time developing a full exploit. A full exploit helps in considering the risk of a specific finding, but it is not the main objective of this particular test. This is why the write-up describes the classes of issue and their conditions rather than end-to-end attack chains.
Exploitation
The report does not include request or response captures, payloads, commands or code for either finding. It explicitly declines to provide full exploitation. What follows is limited to what the report states about each issue and the conditions under which it matters.
Step 1: HTML-based content display
Avo renders HTML-based content fields. The audit found a bug in that displaying functionality that could lead to hijacking of visitors' or other administrators' browsers. The affected surface is the displaying of HTML-based content, and the consequence described is hijacking of visitors' or other administrators' browsers. The advisory title confirms the class: "Stored XSS (Cross Site Scripting) in html content based fields".
Step 2: Polymorphic resource handling
The second issue is in the handling of polymorphic resources and is described as potentially critical. The associated advisory is titled "Possible unsafe reflection / partial DoS", which places the weakness in unsafe reflection with a denial-of-service dimension. The report does not spell out the exact call path or the input that reaches it.
Step 3: Disclosure and fixes
Both issues were reported responsively and published at the time a fix was released in the normal release cycle. The public disclosure states that v2.33.3 contains fixes for both vulnerabilities. The authors also note that they would release findings only after confirming the fixes were present in all of Avo's latest release channels and after users were notified that they must update to be secure.
Root cause
The report does not give a code-level root cause for either finding. What it does say is enough to frame both.
For the stored XSS, the mistake is in the displaying functionality of HTML-based content: The report does not describe the rendering path in code. Rails' best practices and the use of standard Active Record functions and an external, well-known search gem reduce the risk of common vulnerabilities, but they do not automatically sanitise HTML that an administrative interface is designed to display.
For the polymorphic resource issue, the associated advisory names unsafe reflection and partial DoS.
Impact
For the stored XSS, the stated impact is hijacking of visitors' or other administrators' browsers. Because the content is stored and displayed in the administrative interface, the affected parties are the people who view the rendered content, which includes other administrators. The report does not enumerate what an attacker could do after hijacking a session.
For the polymorphic resource issue, the report calls it potentially critical and the advisory names a partial DoS alongside unsafe reflection. The report does not quantify the availability impact or describe which requests trigger it.
The authors are careful about the limits of their own work: this was a two-day white box audit, not a comprehensive penetration test, and no full exploitation was developed for either finding. The impact statements should be read with that scope in mind.
Fix
The authors state that findings would be published only after the fixes were confirmed in all of Avo's latest release channels and users were notified that they must update to be secure. If you run Avo, the actionable point from the report is to be on a release that contains these fixes.
Variants to test
These are concrete directions suggested by the two findings, for other Rails-based admin interfaces and similar tooling. The report does not claim any of these were tested against Avo.
- HTML content fields in admin interfaces. Look for fields explicitly typed as HTML and rendered without sanitisation. A positive result is content you control executing in the browser of another user who views the record, for example an administrator opening the detail page.
- Rich text and markdown renderers. Check whether rendered output passes through a sanitiser and whether the allowlist permits event handlers, script URLs or raw tags. A positive result is script execution from stored content viewed by a second account.
- Polymorphic associations resolved from user-influenced input. Trace where a type or class name from a request is used to look up a constant. A positive result is a request that causes the application to resolve an unexpected class or raise an error that reveals the reflection path.
- Reflection-driven lookups with availability effects. Where a class or method name is resolved dynamically, test inputs that cause expensive or failing resolution. A positive result is a measurable slowdown or error response tied to the reflected value.
- Authorisation on display paths. Since the authentication and authorisation parts were manually audited here, test whether a lower-privileged user can store content that a higher-privileged user later views. A positive result is stored content from one role executing in another role's session.
What happened, in plain words
A security company called greenhats uses a piece of software called Avo in some of its production systems. Avo is a building block for Ruby on Rails applications: it gives developers ready-made screens for managing data, the kind of back-office pages where staff list, edit and delete records. Because greenhats relies on Avo in production, its internal rules say the team must run a small security check before trusting such software. So two people, Paul Werther and Anton Strilez, spent two days looking at Avo's source code. This kind of check, where you are allowed to read the code itself rather than just poke at a running website from outside, is called a white box code audit.
The authors are careful to say this was not a full penetration test. A proper, comprehensive test of an application this size should be scheduled for at least two weeks. Two days is enough to spot obvious risks, not to prove every possible attack end to end.
They found two problems:
- A bug in how Avo displays content that is written in HTML (the language web pages are made of). This could lead to hijacking of visitors' or other administrators' browsers. This class of bug is called stored XSS, short for Cross Site Scripting.
- A potentially critical issue in how Avo handles "polymorphic resources", a Rails concept explained later. The related security advisory calls it "Possible unsafe reflection / partial DoS".
The report notes that v2.33.3 contains fixes for both vulnerabilities. The work produced two official vulnerability identifiers, called CVEs:
- CVE-2023-34102, credited to FLX | Paul Werther
- CVE-2023-34103, credited to Mys7ic | Anton Strilez
Two GitHub advisories accompany them: "Possible unsafe reflection / partial DoS" (GHSA-86h2-2g4g-29qx) and "Stored XSS (Cross Site Scripting) in html content based fields" (GHSA-5cr9-5jx3-2g39). The full penetration test report is published as a PDF titled "Penetration test report, Avo v3.0.0.pre12-2023".
The authors also explain their disclosure policy: because these findings affect the security of everyone using Avo, they would publish details only after confirming the fixes were in all of Avo's latest release channels and after users had been told they must update. That is a common and responsible way to handle security bugs: give people a chance to patch before the details become public.
Context
What Avo is
Avo is a "gem". In the Ruby world, a gem is a packaged library, a reusable bundle of code that other developers install into their project instead of writing everything themselves. Avo is a gem for Ruby on Rails, a popular framework for building web applications. Avo's job is to generate administrative interfaces: the internal pages where staff manage the data behind a site. If you have ever seen a company's back office where an employee edits customer records, that is the kind of screen Avo helps build.
The version examined here was 3.0.0.pre12. The "pre" part means it was a pre-release, a version published before the final stable release.
Why the audit happened
greenhats uses Avo in some production environments. "Production" means the real systems that real users depend on, as opposed to test systems. Internal policy therefore requires a small penetration test or white box code audit to find obvious potential risks before the software is relied on. The authors stress the scope: this is not a comprehensive penetration test. For an application of this type and size, a full engagement should be scheduled for at least two weeks. The audit itself took two days.
How the results were shared
The report and the test are a public community contribution from greenhats to the Avo project. Because the findings have a critical impact on the security of Avo users, the authors state that findings would be released only after confirming they were fixed in all of Avo's latest release channels, and after users were notified that they must update. The public disclosure notes that v2.33.3 contains fixes for both vulnerabilities.
Two CVEs came out of the work. A CVE is a publicly catalogued identifier for a known security vulnerability, so that everyone can refer to the same bug by the same name:
A GitHub advisory is a public notice, hosted on GitHub, that describes a vulnerability and which versions fix it.
Setup
The entire code base of Avo in version 3.0.0.pre12 was audited using both automated and manual techniques. "Automated" means tools that scan code for known risky patterns; "manual" means a person reading the code and reasoning about it. In addition, the authentication and authorisation parts were manually audited. Authentication is the process of proving who you are, for example by logging in with a password. Authorisation is what you are then allowed to do, for example whether you may delete a record or only view it. These two areas are where many serious bugs live, so they got human attention rather than only tooling. No specific accounts, roles, tools or deployment configuration are described beyond this.
The authors note that Ruby on Rails itself contains many best practices for security implementations and greatly reduces the risk and potential of common vulnerabilities. In particular, the use of standard Active Record functions and an external, well-known gem for all search operations makes it more difficult to find typical vulnerabilities. Active Record is the part of Rails that talks to the database; using its standard functions means queries are built in a safe, structured way rather than by gluing text together, which is how many injection bugs arise. Using a well-known external gem for search means the search logic was not hand-written by Avo's authors, so it is less likely to contain the usual mistakes.
This framing matters for reading the findings. The framework raised the bar, and the issues that surfaced were in Avo's own handling of content and resources rather than in generic query construction. In everyday terms: the building's foundations were solid, and the problems were in the furniture Avo added on top.
Finding it
Two issues were identified.
- A bug in the displaying functionality of HTML-based content that could lead to hijacking of visitors' or other administrators' browsers. The advisory title names stored XSS in html content based fields.
- A potentially critical security issue in the handling of polymorphic resources. The associated advisory is titled "Possible unsafe reflection / partial DoS".
The authors state that, due to time constraints, they do not provide full exploitation of either finding. Their position is that applying security mitigations even for potential vulnerabilities should be the main goal of a white box code audit, rather than spending too much time developing a full exploit. A full exploit helps in considering the risk of a specific finding, but it is not the main objective of this particular test. This is why the write-up describes the classes of issue and their conditions rather than end-to-end attack chains.
In plain terms: they found the weak spots and explained why they matter, but they did not build a complete weapon that walks through every step of an attack. That is a deliberate choice, not an oversight.
Exploitation
The report does not include request or response captures, payloads, commands or code for either finding. It explicitly declines to provide full exploitation. What follows is limited to what the report states about each issue and the conditions under which it matters.
Step 1: HTML-based content display
Avo renders HTML-based content fields. "Rendering" means turning stored data into the page a browser displays. HTML is the language that describes web page structure and content, and it can also carry scripts, small programs that the browser runs. Avo has fields specifically meant to hold HTML content, and the audit found a bug in that displaying functionality that could lead to hijacking of visitors' or other administrators' browsers.
The affected surface is the displaying of HTML-based content, and the consequence described is hijacking of browsers. "Stored" means the malicious content is saved on the server first, for example in a database record, and then shown to whoever views that record later. "XSS", Cross Site Scripting, means that content which should be treated as plain text is instead treated as code by the browser and executed. The advisory title confirms the class: "Stored XSS (Cross Site Scripting) in html content based fields".
A simple comparison: imagine a noticeboard where anyone can pin a note. If the rule is "read the note as words", all is well. If someone pins a note that says "whoever reads this, hand me your keys", and the noticeboard treats that as an instruction rather than text, every reader is in trouble. Stored XSS is that noticeboard problem in a browser.
Step 2: Polymorphic resource handling
The second issue is in the handling of polymorphic resources and is described as potentially critical. The associated advisory is titled "Possible unsafe reflection / partial DoS", which places the weakness in unsafe reflection with a denial-of-service dimension. The report does not spell out the exact call path or the input that reaches it.
Two concepts need explaining here. A "polymorphic" association in Rails is a way for one record to belong to one of several different types of record. Think of a comment that can be attached either to a photo or to a video: the comment stores both the type (photo or video) and the identifier of the specific one. "Reflection" is a programming feature where code can look up and use other code by its name at runtime, for example turning the text "Photo" into the actual Photo class. It is powerful, and it is risky when the name comes from user input, because an attacker may be able to make the program look up something it never intended to. "DoS", denial of service, means making a system unavailable or very slow, for example by forcing it to do expensive work. "Partial" suggests the effect is limited rather than a total outage.
Step 3: Disclosure and fixes
Both issues were reported responsively and published at the time a fix was released in the normal release cycle. The public disclosure states that v2.33.3 contains fixes for both vulnerabilities. The authors also note that they would release findings only after confirming the fixes were present in all of Avo's latest release channels and after users were notified that they must update to be secure.
Root cause
The report does not give a code-level root cause for either finding. What it does say is enough to frame both.
For the stored XSS, the mistake is in the displaying functionality of HTML-based content: The report does not describe the rendering path in code. Rails' best practices and the use of standard Active Record functions and an external, well-known search gem reduce the risk of common vulnerabilities, but they do not automatically sanitise HTML that an administrative interface is designed to display. "Sanitise" means cleaning content so that anything dangerous, such as scripts, is removed or neutralised before it reaches the browser.
For the polymorphic resource issue, the associated advisory names unsafe reflection and partial DoS. A "sink" is the place in the code where dangerous input finally gets used.
Impact
For the stored XSS, the stated impact is hijacking of visitors' or other administrators' browsers. Because the content is stored and displayed in the administrative interface, the affected parties are the people who view the rendered content, which includes other administrators. The report does not enumerate what an attacker could do after hijacking a session. A "session" is the state of being logged in: the browser holds something, often a cookie, that proves to the server who you are. If an attacker can run code in your browser while you are logged in, that is serious, because the code runs with your privileges.
For the polymorphic resource issue, the report calls it potentially critical and the advisory names a partial DoS alongside unsafe reflection. The report does not quantify the availability impact or describe which requests trigger it.
The authors are careful about the limits of their own work: this was a two-day white box audit, not a comprehensive penetration test, and no full exploitation was developed for either finding. The impact statements should be read with that scope in mind.
Fix
The authors state that findings would be published only after the fixes were confirmed in all of Avo's latest release channels and users were notified that they must update to be secure. If you run Avo, the actionable point from the report is to be on a release that contains these fixes.
Variants to test
These are concrete directions suggested by the two findings, for other Rails-based admin interfaces and similar tooling. The report does not claim any of these were tested against Avo.
- HTML content fields in admin interfaces. Look for fields explicitly typed as HTML and rendered without sanitisation. A positive result is content you control executing in the browser of another user who views the record, for example an administrator opening the detail page.
- Rich text and markdown renderers. Check whether rendered output passes through a sanitiser and whether the allowlist permits event handlers, script URLs or raw tags. An "allowlist" is a list of things that are explicitly permitted; anything not on it should be blocked. "Event handlers" are attributes that make the browser run code when something happens, such as a click. "Script URLs" are links whose target is code rather than a page. A positive result is script execution from stored content viewed by a second account.
- Polymorphic associations resolved from user-influenced input. Trace where a type or class name from a request is used to look up a constant. A "constant" is a named value in code, such as a class name. A positive result is a request that causes the application to resolve an unexpected class or raise an error that reveals the reflection path.
- Reflection-driven lookups with availability effects. Where a class or method name is resolved dynamically, test inputs that cause expensive or failing resolution. A positive result is a measurable slowdown or error response tied to the reflected value.
- Authorisation on display paths. Since the authentication and authorisation parts were manually audited here, test whether a lower-privileged user can store content that a higher-privileged user later views. A positive result is stored content from one role executing in another role's session.
Glossary
- Active Record: the part of the Ruby on Rails framework that reads and writes database records, building queries in a structured, safer way.
- Administrative interface: the internal pages of an application where staff manage data, such as listing, editing and deleting records.
- Allowlist: a list of things that are explicitly permitted; anything not on the list is blocked.
- Authentication: proving who you are, for example by logging in.
- Authorisation: what you are allowed to do once you are known, for example view versus delete.
- Automated technique: a security check performed by tools that scan code for risky patterns.
- Constant: a named value in code, such as a class name, that can be looked up by name.
- Cookie: a small piece of data a browser stores for a website, often used to remember that you are logged in.
- CVE: a publicly catalogued identifier for a known security vulnerability.
- Denial of service (DoS): making a system unavailable or very slow, for example by forcing expensive work.
- Exploit: a concrete attack that takes advantage of a vulnerability.
- Gem: a packaged, reusable library of Ruby code that developers install into a project.
- GitHub advisory: a public notice on GitHub describing a vulnerability and the versions that fix it.
- HTML: the language that describes the structure and content of web pages; it can also carry scripts.
- HTML-based content field: a field in an application explicitly meant to hold HTML content.
- Manual technique: a security check performed by a person reading and reasoning about code.
- Markdown: a lightweight way of writing formatted text that is later converted to HTML.
- Mitigation: a change that reduces or removes a risk.
- Partial DoS: a denial of service that degrades a system rather than taking it down completely.
- Penetration test: an authorised attempt to find security weaknesses in a system, often from the outside.
- Polymorphic association / resource: a Rails relationship where one record can belong to one of several different types of record.
- Pre-release: a version published before the final stable release.
- Production environment: the real systems that real users depend on.
- Reflection: a programming feature where code looks up and uses other code by its name at runtime.
- Render: to turn stored data into the page a browser displays.
- Ruby on Rails: a popular framework for building web applications in the Ruby language.
- Sanitise: to clean content so that anything dangerous, such as scripts, is removed or neutralised.
- Script: a small program that a browser can run.
- Session: the state of being logged in, usually proven to the server by a cookie or token.
- Sink: the place in code where dangerous input finally gets used.
- Stored XSS: Cross Site Scripting where malicious content is saved on the server and later shown to whoever views it.
- Unsafe reflection: reflection where the name being looked up can be influenced by an attacker.
- White box code audit: a security review where the reviewer can read the source code, as opposed to only testing from outside.
- XSS (Cross Site Scripting): a vulnerability where content that should be treated as text is executed as code by the browser.