Presented at c0c0n 2014, “My tryst with Source Code Review” follows an Information Security Consultant through a first year of hands-on source code review with the CodeVigilant project. The deck covers the reasons for stepping away from bug bounties, how the community project targeted the WordPress plugin and theme ecosystem, the automation-first methodology that surfaced over 250 vulnerabilities, the PHP dangerous-function checklist shared with attendees, and why both open-source and commercial scanners missed findings that simple custom scripts caught.
Summary
The talk opens with the position at the time: a black-box penetration tester and tool author, project leader for Android Tamer and CodeVigilant, with a past life as a system administrator and the developer of wp-filemanager with more than one lakh downloads. Expectations were set honestly: no tool release, no highly sophisticated code, no artificial intelligence, and no deep SAST discussion, with a disclaimer that no commercial source code review tools were harmed during the exercise.
The deck reframes Linus Torvalds’ “with enough eyes all bugs are shallow” into “with enough expert eyes all bugs are shallow” and explains the motivation: become the expert eye and learn new things. Bug bounties came first, but they proved mostly about alert(‘XSS’) and X-FRAME-OPTIONS or httpOnly findings, with a small black-box surface area, so the move to code review followed even though whitebox was not exactly home ground.
The narrative then follows the project’s arc. A #nullblr meet brought fellow researcher Prajal Kulkarni into the picture, and the two started CodeVigilant, a community collaboration to make open-source software secure by finding bugs, responsibly disclosing them to authors, and publishing advisories after a sufficient interval. They picked the WordPress ecosystem: plugins and themes first, core later. The first attempt, downloading the top ten plugins and analyzing one by one, ended in frustration within days. The re-roll was to automate: download all plugins and themes, then focus on vulnerability types rather than individual plugins.
The demos and tooling walk through this automation. A quick WordPress information extractor and downloader, a simple Python script with grep/cut friendly output, fed the pipeline. The error_finder script, released at github.com/Codevigilant/error_finder, found massive amounts of Full Path Disclosure and a few direct access issues, though WordPress’ stance on FPD made reporting pointless. Understanding the ecosystem meant mapping WordPress user roles from Super Administrator to Subscriber and prioritizing unauthenticated issues first, then subscriber and contributor issues, since editors and admins already have unescaped HTML access.
The XSS hunt is the centerpiece: grepping for echo $_GET patterns produced massive entries, but the team realized content type matters. XSS works when the response is text/html and fails for JSON, XML, and JavaScript, so a second set of scripts captured proper response types. Work on OWASP A9 flagged outdated SWF binaries and old library files, and inspathx-derived error messages yielded directory traversal findings as a by-product. The phase closed with 250 plus issues across WordPress plugins.
The deck closes with phase 2 planning (authenticated SQL injection, stored/reflected XSS in the admin console, CSRF, and more), the hurdles of mapping all 30K plugins to user roles, the expanded four-person team, an appeal for volunteers and contributors who keep any bounty they earn, the PHP dangerous-function checklist for the audience, and a simple checklist for approaching source code review. A late section explains why automated scanners were not used: RATS and other open-source tools barely worked, RIPS demanded a web workflow that kept hanging, and one commercial cloud-hosted product also missed simple XSS and SQLi because CMS-specific functions like WordPress query wrappers were unknown to the scanners.
Key Themes
- The CodeVigilant Project: A community collaboration founded with Prajal Kulkarni to make open-source software more secure through systematic code review and responsible disclosure. The project grew to a four-person team (Anant Shrivastava, Prajal Kulkarni, Chaitu, Madhu Akula) and focused on the WordPress ecosystem as its initial target.
- Why source code review over bug bounties: Bug bounty programs were found to have limited surface area, mostly yielding trivial XSS and header-related findings. Source code review offered deeper access and more meaningful vulnerability discovery, especially for open-source projects.
- Automation-first approach: Rather than manually reviewing plugins one by one, which quickly led to frustration, the team pivoted to automating downloads of all plugins and themes, then focusing on vulnerability types across the entire corpus. Custom Python scripts with grep/cut friendly output were developed for WordPress information extraction and bulk downloading.
- Phase 1, unauthenticated issues: The team started with easy wins like direct/unauthorized access and Full Path Disclosure using the custom error_finder tool, then moved to Cross-Site Scripting by grepping for echo $_GET patterns, followed by more sophisticated parameter extraction and URL testing.
- The content-type lesson: XSS only works with text/html responses, not JSON, XML, or JavaScript responses, so later scripts captured proper response types alongside the parameter tests.
- OWASP A9 and by-products: The team identified outdated SWF binaries and old library files bundled within plugins, and error messages extracted via inspathx code yielded additional issues such as directory traversal.
- Phase 2 planning: Authenticated issues (SQL Injection, Stored/Reflected XSS in the admin console, CSRF, and more) require mapping all 30K plugins to WordPress user roles (Super Administrator, Administrator, Editor, Author, Contributor, Subscriber) since impact is prioritized by user access.
- PHP vulnerable functions reference: A checklist of dangerous PHP functions organized by category: file operations (fopen, file_get_contents), database functions (mysql_query, pg_query), command execution (exec, system, shell_exec, proc_open), file inclusion (include, require), user input superglobals ($_GET, $_POST, $_REQUEST), and output functions susceptible to XSS (echo, print, printf).
- Why automated scanners failed: Both open-source tools (RATS, RIPS) and one commercial SAST product missed simple XSS and SQLi because they lacked awareness of CMS-specific functions, such as WordPress query wrappers versus raw mysql_query. RIPS also had workflow issues requiring web-based interaction that frequently hung.
- Source code review checklist: A structured approach covering unauthenticated flaws (Reflected XSS, SQLi, direct access, directory traversal), understanding application architecture (language-specific checks, user roles and impact), and authenticated section attacks (Stored XSS, CSRF, XSPA, SQL Injection).
Notable Points
- Bug bounties were set aside after most programs proved to revolve around alert(‘XSS’) and X-FRAME-OPTIONS or httpOnly findings, with a small black-box surface area.
- CodeVigilant started with Prajal Kulkarni after the two touched bases during a #nullblr meet, and grew into a four-person team: Anant Shrivastava, Prajal Kulkarni, Chaitu, and Madhu Akula.
- The team released the error_finder script at github.com/Codevigilant/error_finder, which surfaced a massive amount of Full Path Disclosure and a few direct access issues.
- XSS hunting began with grep “echo $_GET” and moved to attempt two: extract all GET/POST/REQUEST parameters and access the URL with those parameters in place.
- Findings must be validated against content type: XSS works when the response is text/html and fails when it is JSON, XML, or JavaScript.
- OWASP A9 (Known Vulnerable Components) work identified outdated SWF binaries and old library files bundled within plugins, and inspathx error output yielded directory traversal findings as a by-product.
- Phase 1 closed with 250 plus issues in various WordPress plugins; Phase 2 targets authenticated issues and requires a script to map all 30K plugins with each type of access.
- Takeaway: when approaching source code review at scale, automate the collection and focus on vulnerability types across the entire codebase rather than reviewing individual components sequentially.
- Takeaway: understand the target application’s architecture, especially user roles and permission models, before prioritizing which vulnerabilities to hunt, as impact varies significantly by access level.
- Takeaway: maintain a language-specific checklist of dangerous functions (sinks) and user-controlled inputs (sources) to systematically identify potential vulnerabilities through grep-based searches.
- Takeaway: validate findings by checking response content types, and do not rely solely on automated SAST tools for CMS or framework-based code; combine automated scanning with manual review and custom scripts.
- Takeaway: contributors can join the team for continuous contribution with an author’s page at CodeVigilant and keep any bounty earned, or submit one-off findings for coordination, patching, and co-credited advisories.
Notable Quotes
“With enough expert eyes all bugs are shallow”
“No commercials Source code review tools were harmed during the exercise.”
“Ended up getting frustrated in couple of days”
“Focus on vulnerability type and not on individual plugin”
“If Content type is text/html XSS works”