top of page
Search
ylesgeltiore

Graudit – Code Audit Tool Using Grep: Tips and Tricks for Better Code Auditing



Analysis of source code helps to find programming flaws including those that can lead to software vulnerabilities. Graudit helps to uncover these by searching through the files and discover possible flaws. The tool supports languages like ASP, C, Perl, PHP, Python, and others.


Graudit is short for Grep rough audit. Not surprisingly, it uses the GNU grep utility to find security flaws in source code. The tool has a set of database files that include patterns for each supported programming language. It uses these patterns to evaluate the code and see if there are any positive matches. If the tool finds a match, it will display this.




Graudit – Code Audit Tool Using Grep




Graudit is a simple script and signature sets that allows you to find potential security flaws in source code using the GNU utility, grep. It's comparable to other static analysis applications like RATS, SWAAT, and flaw-finder while keeping the technical requirements to a minimum and being very flexible.


Hmm ? !! We think you should know about some basic commands of the grep utility before jumping to the source code review, so we have given some basic commands below which will facilitate you to use grep utility during SAST audit.


Cat is another tool comes pre-installed in kali linux in order to edit or create files. cat which simply send the contents of the file to standard output, which shows up on the standard input of the grep, because the shell has connected the two with a pipe. As you can see below that with the help of these two combinations, we can print the exact output on the terminal.


RIPS is the most popular static code analysis tool to automatically detect vulnerabilities in PHP applications. By tokenizing and parsing all source code files, RIPS is able to transform PHP source code into a program model and to detect sensitive sinks (potentially vulnerable functions) that can be tainted by user input (influenced by a malicious user) during the program flow. Besides the structured output of found vulnerabilities, RIPS offers an integrated code audit framework.


Graudit allows the user to find potential vulnerabilities within the source code of a software. It uses the GNU utility grep to compare the source code with signature sets within different databases. It is comparable to other analyzers such as RATS, SWAAT and flaw-finder while keeping the technical requirements to a minimum and retaining its flexibility.


There may be scenarios where we need to search specific patterns or keywords to identify potential issues. The GREP tool in Linux is a common search tool for source code or plain text configurations. For code-security reviews, here are some security scanning tools that provide GREP-like search functionality:


Eldar built the source code auditing tool graudit (grep rough audit). We discuss what it's like to build a tool and some of the unknowing benefits it's led to in his career. Eldar also shares advice for any aspiring pentesters.


This is a runtime test using a 2017 Macbook Pro (3.1 GHz Quad-Core Intel i7) on four repositories. The runtime was measured in wall-clock time for an entire invocation of the command. For a better comparison, Semgrep was run in single-threaded mode because, at the time of this writing, Bandit does not support multi-threaded scans.


There are many reasons to choose open source software, tools, and projects as a part of your development. It won't cost any money, as you're using a tool developed by a like-minded community of developers who want to help other developers. If you have a small team or a startup, it's good to find open source software to check your code security. This keeps you from having to hire a separate DevSecOps team, keeping your costs lower.


But there can be times where you need a feature that is not available within the tool that you chose. Then you have the option to fork the code and develop your own feature on top of it and use it in your system.


There are various open source static code analysis tools available, but as you know, the tool analyzes the code itself, and that's why there is no generic tool for any and all programming languages. But some of them follow OWASP guidelines and try to cover as many languages as they can.


Graudit uses grep, which is a GNU-licensed utility tool, and there are similar types of static code analysis tools like Rough Auditing Tool for Security (RATS), Securitycompass Web Application Analysis Tool (SWAAT), flawfinder, etc. But the technical requirement it has is minimal and very flexible. Still, you might have requirements that are not served by Graudit. If so, you can look at this list for other options.


Graudit supports a lot of languages, which makes it a good bet for users on many different systems. It's comparable to other free or paid tools because of its simplicity of use and broad language support. Most importantly, they are under development, and the community supports other users too.


Though this is a handy tool, you may find it difficult to identify a specific code as "vulnerable." Maybe the developers will include this function in future versions of the tool. But, it is always good to keep an eye on security issues in the code by using tools like this.


USAGE graudit supports several options and tries to follow good shell practices. For a list of the options you can run graudit -h or see below. The simplest way to use graudit is; graudit /path/to/scan


In the world of APIs, looking for dangerous sinks is very much language-dependent. Luckily for us, a lot of research has already been done in this field of research. In fact, there is an awesome database of dangerous sink signatures maintained by Eldar Marcussen (aka wireghoul) in the graudit project.


TIP: If you decide to use the graudit signatures, always start by looking for the fruit.db for the language. This contains the most common (aka low-hanging fruit) signatures of dangerous sinks for that language.


So the first thing to do is search for all possible dangerous sinks based on the Java language. Years ago, I would just use a bash script that would loop through a wordlist of dangerous sinks and grep through the source code. However, these days we can use graudit to do all the heavy lifting for us.


ISACA is fully tooled and ready to raise your personal or enterprise knowledge and skills base. No matter how broad or deep you want to go or take your team, ISACA has the structured, proven and flexible training options to take you from any level to new heights and destinations in IT audit, risk management, control, information security, cybersecurity, IT governance and beyond.


Scope Notes: Used in quality assurance (and in general, in information systems audit), to check process compliance, code standardization and error prevention, and other items for which consistency processes or standards have been defined


Scope Notes: Adoption and use of the COBIT framework are supported by guidance for executives and management (Board Briefing on IT Governance, 2nd Edition), IT governance implementers (COBIT Quickstart, 2nd Edition; IT Governance Implementation Guide: Using COBIT and Val IT, 2nd Edition; and COBIT Control Practices: Guidance to Achieve Control Objectives for Successful IT Governance), and IT assurance and audit professionals (IT Assurance Guide Using COBIT). Guidance also exists to support its applicability for certain legislative and regulatory requirements (e.g., IT Control Objectives for Sarbanes-Oxley, IT Control Objectives for Basel II) and its relevance to information security (COBIT Security Baseline). COBIT is mapped to other frameworks and standards to illustrate complete coverage of the IT management life cycle and support its use in enterprises using multiple IT-related framework and standards.


An independent review of source code by a person, team or tool to verify compliance with software design documentation and programming standards. Correctness and efficiency may also be evaluated. Contrasts with code inspection, code review and code walkthrough.


A lock that sets by the smart contract code before using a shared resource or function, and release that after using it. When locked, the lock prevents no other threads can gain access to the locked region of the code.


A simple UNIX utility, which reads and writes data across network connections using Transmission Control Protocol (TCP) or User Datagram Protocol (UDP). It is designed to be a reliable back-end tool that can be used directly or is easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, because it can create almost any kind of connection needed and has several interesting built-in capabilities. Netcat is now part of the Red Hat Power Tools collection and comes standard on SuSE Linux, Debian Linux, NetBSD and OpenBSD distributions.


A process or meeting during which a work product or set of work products is presented to project personnel, managers, users, customers or other interested parties for comment or approval. Types include code review, design review, formal qualification review, requirements review and test readiness review. Contrasts with audit and inspection. 2ff7e9595c


1 view0 comments

Recent Posts

See All

Comments


bottom of page