Application Security Guidelines
Application Security Guidelines
Design, Development,
Implementation & Operations
Issued by:
Table of Contents
Application ................................................................................................... 4
Operations.................................................................................................. 13
One of the key reason for vulnerabilities in the applications are lack of secure design,
development, implementation, and operations. Relying solely on post-development audits
for security is inadequate. Instead, security must be an inherent and integral aspect,
seamlessly integrated into the application's design and development lifecycle.
Organization should incorporate secured application development practices and
application owners should ask for adherence to the best practices highlighted in this
document and should not only rely on the post audit. By adhering to these guidelines,
applications can be developed with built-in security measures making it difficult target for
security breaches and exploitation.
The guidelines have been divided into four phases, as depicted in Figure 1 below.
After the adoption of secure application design and development guidelines, the
application can undergo both source-code review and black-box testing by CERT-In
empaneled auditing organization to identify any lapses / vulnerabilities in implementation
of the security practices in the application. Key findings and recommendations in the
guidelines are mined from the field data analysis of audits conducted by CERT-In
empaneled auditing organizations.
This guideline has been issued by Indian Computer Emergency Response Team (CERT-
In) for the entities engaged in developing or outsourcing application development
(especially for government sector entities). The prime objective of this guideline is to
establish a firm and robust application security baseline in application development
lifecycle. The concept of application security pertains to the comprehensive approach for
safeguarding all dimensions of an application. This includes its design, development,
deployment, and maintenance phases. Hence, the purposeful inclusion of application
security is driven by the intention to offer guidance to the target audience, aiming to
foster the development of secure applications. This approach is crucial for ensuring the
application's security right from the initial phase and progressively strengthening every
phases of application development lifecycle.
3.2 Adoption of Secure Software Development Life Cycle (SDLC): Secure SDLC
is a methodological approach that integrates security practices throughout the
software development life cycle. It enables organization to incorporate security as
a key component of the development process ensuring compliance with global
standards, build software with robust security measures, reducing the likelihood of
security breaches, protecting sensitive data, and delivering secure & reliable
software. Secure Software Development Life Cycle (SDLC) encompasses various
models and frameworks:
a) "Microsoft Secure Development Lifecycle (SDL)" is a widely known and
adopted SDLC framework with seven phases.
b) "Open Web Application Security Project (OWASP) Software Assurance
Maturity Model (SAMM)" helps build mature software security programs with
four levels and multiple security practices.
c) "Agile Secure Development Lifecycle" integrates security practices within agile
methodologies, including security grooming, security testing, continuous
integration & deployment, security feedback loop.
d) "NIST Secure Software Development Framework (SSDF)" is a comprehensive
guide for developing secure software.
integrity of data (digital signatures) and produce data representations with defined
sizes (hashing). The outdated cryptographic techniques and custom
implementation should be avoided.
4.3 Version Control and Change management: These are set of practices &
procedures that are used to manage and control modifications in application
configurations and source code. In version control, a system that monitors and
controls changes to files or source code in order to facilitate collaboration,
maintain a change history, and allow revert / rollback to previous versions for
testing and compliance checks. Change management, on the other hand, is the
process of planning, analysing, approving, and implementing changes to
application or systems. It ensures that changes have been carefully assessed,
tested, well-documented, and implemented in a controlled manner.
4.4 Ensure Secure Coding: Proper input validation using regex techniques and built-
in security controls provided by programming frameworks in order to validate and
sanitize all user inputs should be implemented to prevent common vulnerabilities
like SQL injection, cross-site scripting (XSS) and command injection. Ensure that
special characters or sequences in the application code are converted into an
alternative, yet equivalent format that poses no threat when processed by the
intended interpreter. This is done to prevent injection attacks and unexpected
behavior, using encoding methods like URL encoding. In addition to encoding,
escaping techniques involving adding extra characters or sequences before a
special character or sequence to ensure correct interpretation and maintain the
intended behavior of the code.
4.5 File & Memory Management: To develop a secure and robust application, it is
imperative to prioritize meticulous file and memory management within your
coding practices. File management involves handling files and file-related
operations in a secure manner to prevent vulnerabilities, while memory
management refer to proper allocation and deallocation of memory in a program to
prevent vulnerabilities like buffer overflows and memory leaks.
4.11 Secure Use of Environment Variables: To enhance the security of controlled file
access and provide an additional layer of protection, it is recommended to utilize
environment variables instead of plain text files. Furthermore, it is important to
treat input from environment variables as untrusted and validate it accordingly.
Storing sensitive information in environment variables should be avoided to
minimize the risk of unauthorized access or exposure of sensitive data.
4.12 Stored Procedures Over SQL Statements: Stored procedures should be used
instead of constructing SQL statements to reduce the chances of injection attacks.
As stored procedures restrict direct user access to the database table and provide
an additional layer of security. Additionally, stored procedures should be integrated
with security measures such as encryption, access control policies, and network
security measures. It is important to address issues like version control and
potential database vendor lock-in, as they can pose obstacles to secure
implementation.
4.13 Handle Error Messages, Commented Code and Exceptions: Prior to deploying
an application into a production environment, it is crucial to remove all commented
code. Additionally, it is important to ensure that sensitive information, such as
system details, network configurations, passwords, server names, IP addresses,
or file system paths, is not exposed through error messages or URL contents.
Proper exception handling should be implemented as a mandatory process, which
involves identifying potential exceptions, using try-catch blocks, handling the
exceptions appropriately, providing feedback to users when errors occur, logging
the errors, and thoroughly testing the exception handling mechanism. It is
recommended to keep necessary access and error logs of the application.
4.14 Linear Data Structure and Multiple Inheritances: Allocate space for linear data
structures like arrays, linked lists, stacks, and vectors based on their required size.
Implement proper access control using 'public,' 'private,' or 'protected' access
modifiers in the code to specify the location or physical address of these data
structures. Avoid multiple inheritances to mitigate potential code vulnerabilities, as
declaring essential variables in the public scope can compromise the abstraction
principle in object-oriented programming.
4.15 Third Party and Open-Source Libraries, Components and APIs: Security
wrapper classes should be created for the open-source and third-party libraries
used in the code. It is important to validate a library's ability to throw exceptions,
including handling "out of memory" exceptions. Additionally, data entry and exit
points of the application should be carefully examined and exceptional handling
mechanisms should be implemented to ensure proper security measures.
An organization should integrate third-party components, open-source
components and APIs into their development projects only after conducting a
4.16 Build Trust Boundaries: A trust boundary should be established between the
front-end entry, exit points and the back-end of the application. This means that
data received from client-side validations should be treated as untrusted and
undergo validation on the back-end.
5.1 Source Code Review: It is a process that examines an application's source code
to identify security flaws or vulnerabilities. It ensures adherence to coding
standards, uncovers bugs, and identifies potential threats, such as SQL injection
and cross-site scripting. Source code reviews can help detect errors and
vulnerabilities that may have been overlooked during the development phase.
Source code reviews encompass both manual and automated reviews. Manual
reviews can evaluate the logic and design of the code, identifying issues that
automated tools may overlook. Automated tools can scan large codebases for
common vulnerabilities and coding errors. To enhance the quality of source code
review in terms of security, it is imperative to integrate both static and dynamic
scan i.e. Static Application Security Testing (SAST) and Dynamic Application
Security Testing (DAST). SAST provides early detection by analysing static code,
addressing potential coding errors, while DAST evaluates the running application,
simulating real-world attacks and identifying runtime vulnerabilities. The
combination of SAST and DAST offers a comprehensive approach, fortifying the
source code review process throughout the software development lifecycle and in
real-world scenarios, thereby enhancing the overall security of the application.
5.3 Timeline for Completion of Audit: Audit report should mention appropriate
timelines for closure of vulnerabilities according to severity.
5.5 Logging and Audit Trails: Logging and audit trail functionality should be
integrated in the application for troubleshooting and compliance requirement.
Logging helps in error detection, troubleshooting, and performance optimization by
maintaining a detailed record of application activities, enabling swift identification
and resolution of issues. On the other hand, audit trails enhance security,
compliance, and accountability by documenting every user action and system
event within the application.
5.6 Precondition for Assessment and Audit: Application developed without any
secure design and development practices should not be considered for
assessment and audits. Auditee organizations and auditor organizations must
confirm that application is designed & developed with secure practice prior to
commencing any assessment.
6.1 Secure Deployment and Configuration: There should not be any changes in
audited application code or configurations and application should be hosted in
secure & tested environment. Ensure continuous logging and monitoring of logs.
Utilize secure configuration management tools like Ansible, Puppet, etc., to
establish secure deployment configurations. Implement secure communication
protocols and access controls for the deployment environment, including firewalls,
VPNs, and IP restrictions. When employing automated deployment tools such as
Docker, Kubernetes, and Jenkins, verify and apply appropriate security measures.
Regularly update software and dependencies to maintain a secure deployment
environment.
6.2 Provision for Patch and Update: The comprehensive documentation detailing
the security features integrated into the architecture, codebase, APIs, and data
interactions of the application should be prepared. Also, ensure that all features
are meticulously designed with backward compatibility in mind, and steer clear of
making incompatible changes to existing APIs and data structures. In case
vulnerabilities are discovered in the application, there should be a structured
process to apply patches or fixes. This involves testing patches to ensure they
don't introduce new issues / vulnerabilities, maintaining a change control process
for documentation and accountability, and communicating changes to relevant
stakeholders.
6.3 Secure Development of Update, Patch & Release to Mitigate Against Supply
Chain Risk from Developers: Secure development of updates, patches, and
************