What Does Your User Agent Say About You?


A user agent is a computer program representing a person, for example, a browser in a Web context.

Besides a browser, a user agent could be a bot scraping webpages, a download manager, or another app accessing the Web. Along with each request they make to the server, browsers include a self-identifying User-Agent HTTP header called a user agent (UA) string. This string often identifies the browser, its version number, and its host operating system.

Spam bots, download managers, and some browsers often send a fake UA string to announce themselves as a different client. This is known as user agent spoofing.

The user agent string can be accessed with JavaScript on the client side using the navigator.userAgent property.

A typical user agent string looks like this: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0".


User Agent String

Browser Data

User Agent Ruby

Brent Mccoy
• Wednesday, 14 October, 2020
• 7 min read

Making statements based on opinion; back them up with references or personal experience. Making statements based on opinion; back them up with references or personal experience.

def app quot ruby


Let your marketing team blog, create landing pages and more w/ our easy-to-use dashboard. Fast content API for modern apps.

With JavaScript popularity rising, most developers have started using libraries such as Modernizer, which detects the specific capabilities of the browser, as this provides much more accurate results. Other browser vendors, including Mozilla Firefox, Microsoft Edge, and Apple Safari, have expressed their support of the move.

In the end, we found no evidence of any customer data exposure or the vulnerability being used in the wild. We’re hoping by giving you some insight into the challenges we faced, it will help others avoid similar situations.

Vulnerable code was responsible for enforcing tenant access with authentication tokens generated by our custom integrations. These tokens worked primarily with our custom integrations, which are commonly used by organizations to develop internal applications against our API.

In this scenario that meant pulling in as much data about requests made with these tokens as we possibly could. This would help us identify suspicious behavior such as unique IPs or other signatures accessing data on multiple organizations, as well as understand which customers may be impacted.

ruby install monitor agent help rails environment

The time window to achieve all of this is very short, as we have committed to notifying our customers and compliance organizations within 48 hours of a breach. Our challenge came into play when we realized we could not associate an entry in our access logs to the token that made the request.

With the above, we were able to extract which organizations were affected by parsing the request_uri, as well as begin searching for patterns using combinations of HTTP_ user _ agent, remote_addr, and time windows. Initially, the data set was extremely large, but because we knew the scope of the vulnerability, we first narrowed it to only customers who even had the possibility of being exposed.

It’s worth noting that our production systems work a bit differently than most organizations. We don’t rely on systems like Splunk or Diana for log access, but rather we store these in Click house (via click tail), which in situations like this is a huge boon.

It allows us to load correlating information (such as a CSV of customers) and filter down the logs extremely quickly using an SQL-like interface. We quickly realized that due to the way the vulnerability worked, it was only active during time ranges which an organization had a custom integration available.

We started by focusing on what requests we could eliminate based on details we keep elsewhere of authenticated sessions. Most companies these days use cloud providers, which means IP spaces aren’t stable.

hershman leeson lynn ruby agent digicult previously unseen conjunction interaction material

For example, we identified Clubhouse due to its Java implementation (surprisingly uncommon), and have a limited set of IPs. So on Day 2 we emailed these customers and let them know that everything appeared fine, and we’d provide updates as they come in.

The tricky bit here is that raw access logs can never obtain this information, as we capture those higher up in the stack. Our solution to this is likely going to be utilizing response headers to propagate up additional metadata to the systems which ultimately capture the logs.

The slug is great for quickly humanizing things, but with forensics, the precision is required. This vulnerability was actually introduced right before our most recent pen test yet it was uncaught, and it is on what is considered a critical path.

If all the data you stored vanished as soon as you returned a response? Maybe it’s a user id, or a preferred language, or whether they always want to see the desktop version of your site on their iPad.

Session is the perfect place to put this kind of data. But it takes coordination between your user ’s browser and your Rails app to make everything connect up.

ruby agent configuration hierarchy ignore errors properly working screenshot below

Because the information inside the cookie isn’t meant for the user. Your Rails app is in charge of figuring out what a cookie means.

If you accidentally expose your secret_key_base, your users can change the data you’ve put inside your cookie. Storing the wrong kind of data inside a cookie.

It’ll store {current_ user _id: 1} (Base64 -encoded) in the data attribute of that record. And it’ll return the generated session ID, 09497d46978bf6f32265fefb5cc52264, to the browser using Set-Cookie.

Then, it returns current_ user _id out of the data attribute of that record. Whether you’re storing sessions in the database, in Memcached, in Redis, or wherever else, they mostly follow this same process.

You don’t have to worry about your session store growing out of control, because older sessions will automatically get kicked out of the cache if it gets too big. If you actually care about keeping old sessions around, you probably don’t want them to get kicked out of the cache.

api attributes adding ruby agent custom

Your sessions and your cached data will be fighting for space. If you don’t have enough memory, you could be facing a ton of cache misses and early expired sessions.

Still, this is how we store session data at Avvo, and it’s worked well for us so far. With some database stores, your sessions won’t get cleaned up automatically.

For example, if you accidentally touch the session on every request, google bot could create hundreds of thousands of useless sessions. If you’re pretty sure you won’t run into any of the cookie store’s limitations, use it.

It doesn’t need much setup, and isn’t a headache to maintain. I treat session data as pretty temporary, so the cache store works well for me.

Related Videos

Other Articles You Might Be Interested In

01: Free Download User Agent Switcher For Firefox
02: Cisco Firepower User Agent Download
03: Cisco Firepower User Agent For Ad Download
04: Cisco User Agent 2.3
05: Cisco User Agent Download
1 -
2 -
3 -
4 -
5 -
6 -