SlideShare a Scribd company logo
WHITE PAPER
TEL USA:	253-872-7788
TOLL FREE:	 +1 800-915-7700
TEL UK:	 +44 (0)870 120 3148
The PowerTech Group, Inc.
www.powertech.com • info@powertech.com
Copyright 2014. PowerTech is a Division of HelpSystems, LLC. All product and company
names are trademarks of their respective holders.
13 Tips to Write Secure Applications
and Boost IBM i Security
By Robin Tatam
Security. It surrounds every aspect of life in the
new millennium, and it’s never going away. Human
nature is such that any time we’re told there’s some-
thing we shouldn’t do or somewhere we shouldn’t go,
someone is always going to do exactly that and go
precisely there. This is especially true when there’s
something to gain by violating the rules.
The proof? Barely a day passes without new headlines
reporting another cyber attack, policy violation, or data
breach. Secretly, we breathe a sigh of relief that it hap-
pened to someone else, but most of us know that we’ll
all eventually feel the impact in some capacity. Maybe
it’ll manifest itself through increased bank fees, higher
retail prices, or more hoops to jump through when
we log in to our corporate firewall. And eventually it
could—nay, it will—be us that it happens to.
So who’s responsible for the security of an IBM i server
and DB2 database? IBM builds the hardware and de-
velops the operating system, application vendors and
internal programmers write the business applications,
and users maintain the corporate data. Who shoulders
the responsibility for its integrity and its protection?
After more than a decade of working as a security
specialist, my answer is a resounding “EVERYONE!”
IBM has done their part. Power Systems servers running
IBM i™ have garnered an envious reputation for being
some of the most securable servers on the planet, with
numerous world-class integrity features. Notice I said
securable instead of secure. The annual IBM i Security
Study reports alarming statistics showing that most of
these servers are operating with default—and largely
open—security configurations. You would never assume
a server running Windows is secure, and you should
never assume it with one running IBM i.
System users, such as programmers and administra-
tors, should be managed by a combination of profile
settings and good auditing controls. Application users
should be managed by the applications. Ultimately,
however, users will do whatever applications allow, not
necessarily only what they’re designed to do. And it’s
programmers who build those applications, so we have
to talk about how to build a more secure application.
The goal of this article is to identify important devel-
opment considerations that will empower program-
mers to enhance the security of our data rather than
undermine it.
Reprinted with permission of MC Press, LLC. All rights reserved. www.mcpressonline.com
13 Tips to Write Secure Applications and Boost IBM i SecurityThe PowerTech Group, Inc.
www.powertech.com • info@powertech.com
1. Docu-what?
Personal experience has taught me that documentation
is a dirty word to many in the programming community.
It hampers our simple desire to code. But documentation
is also the map that guides future travelers. Without
it, every enhancement and bug fix begins with a time-
consuming discovery task and increases the likelihood
that the application could be broken by the change.
Before a single line of code is written, planning docu-
ments should identify operational requirements such
as these:
	 •	 Application libraries
	 •	 Profile ownership
	 •	 Authorization lists
	 •	 Authority schemes—public and private
	 •	 Runtime attributes
Documentation should also be embedded in the
application programs. Comments should be clear,
concise, and in plain English (or your language of
choice). In other words, do not simply repeat what
any programmer can read from looking at the code.
2. Segregate Libraries
When building an application, many programmers
lump all of the objects into a single library as it seems
simpler on the surface. However, programs and files
typically have different security requirements, and
having them cohabit can make securing them more
complicated. Segregating non-data objects and data
objects into different libraries permits library-level
security to control access.
3. “Softcode” Library Lists
I was taught that hard-coding a library name into a
program was a cardinal sin, but we’ve learned that
search path manipulation is an easy way to wreak
havoc and even circumvent security. An acceptable
balance may be found by storing library names in data
objects, such as data areas, so that they cannot be
altered by users but can be changed without requiring
modifications to the application code.
4. Own Your Objects
Every object has an owner, and if you’ve ever had to
delete a user’s profile, then you understand why
ownership shouldn’t be retained by the programmer.
Objects should never be owned by a group profile,
especially one that consolidates the application users;
each member would indirectly own the objects, giving
them excess privileges. Instead, create a profile that
has only one purpose in life: to own the application
objects. Just remember, if new objects are created
during the execution of the application, the program
should also establish the correct ownership and
authorities. Try to avoid assigning ownership to IBM-
supplied profiles because if anyone—including IBM—
makes a change to the profile, it might have an
unpredictable impact on the application.
5. Design the Database
Take time to classify the data in order to identify how
stringent the access control should be. For a simple
scheme, consider public, semi-public, and private. The
database should be normalized to prevent information
redundancy, and I recommend encrypting fields that
are classified as private. Strong encryption functions
are inherent within IBM i, and third-party providers can
assist if code modification isn’t possible. Journaling is a
popular technique that originated with application
recovery and now has uses for replication and for
auditing. Consider collecting before and after images
of data changes in critical files and archiving that
journal data according to corporate policy and
compliance mandates.
6. Read the Menu
Application menus were a solid approach to security
back when terminal displays were the only way to
access data. However, they fall flat on their face now
that other interfaces exist that can facilitate direct
access to the database. There’s nothing wrong with
using menus to improve the user experience and to
restrict user movement, but don’t rely on them to
police data access. When a user steps outside the
constraints of a menu, other controls such as
command line restrictions, object-level security,
and exit programs become even more critical.
13 Tips to Write Secure Applications and Boost IBM i SecurityThe PowerTech Group, Inc.
www.powertech.com • info@powertech.com
7. Good Code
While it seems obvious, write good code! My devel-
opment career exposed me to some of the most
horrendous applications I could imagine. Unwieldy
programs with unmanageable top-down design,
missing—or worse, inaccurate—comments, and
redundant functions. Programs that are modular,
concisely coded, and well-documented are easier to
maintain and easier to review for unauthorized code
modifications. ILE constructs make this easy. You
should be taking advantage of them.
8. Public and Private Authority
IBM i contains a unique concept known as *PUBLIC.
This is the default level of access granted to a user
who hasn’t been assigned a more specific access level.
Many open configurations on servers running IBM i can
be traced to the fact that IBM ships the default
*PUBLIC authority level as *CHANGE, which is
sufficient to read, change, and delete data in a file.
Public authority is determined when the object is
created from a parameter on the associated create
command. By default, the command defers to a library
attribute and that, in turn, defers to the QCRTAUT
system value. I recommend setting the appropriate
explicit value on the library as it allows different
defaults to be used for each application library. The
popular “deny by default” data access model calls for
the public to be excluded, and the application users—
or better yet, user groups—with a demonstrable need
are granted private authority.
9. Authorization Lists
Granting authority to hundreds or even thousands
of individual objects can be an overwhelming admin-
istrative chore. Authorization lists allow many objects
to be addressed as a single entity and are a useful
mechanism. A significant benefit of using lists is that
authorities can be maintained while the associated
objects are in use. This can be very beneficial in a 24/7
shop where obtaining object locks can be a monu-
mental task. Just remember that *PUBLIC authority
will come from the individual object unless you specify
otherwise.
10. Adopted Authority and Profile Swapping
Two techniques are available to allow a program to run
with different authority than the user who invoked it.
Instead of granting authority to individuals or even
groups, authority can be elevated temporarily while
the program is running, alleviating the requirement to
grant authority to the users themselves. In the case of
adoption, a runtime attribute on the program object
controls the inheritance. Both special and private
authority is culled from the owner of the program,
which is beneficial if following the recommendation of
using a unique profile for ownership.
Profile swapping allows a user to assume the identity
of another and is accomplished via calls to several
easy-to-use IBM-supplied APIs. Both approaches have
pros and cons, and more detailed information can be
found using your search engine of choice. Overall, these
are two of the most useful functions in a security-
conscious programmer’s toolbox.
11. Cover Your Exits
IBM i contains a registry of exit points, which are
almost like subroutines in the OS’s functions. When
a function is invoked, the OS can pass control temp-
orarily to the assigned exit program—if one exists—
to perform any ancillary task before the OS resumes
control and processes the request.
There are dozens of exit points in several different
categories, but about 30 of them pertain to network
access and should be considered critical. While object-
level security remains effective during these requests,
the OS can only enforce one setting across all inter-
faces, so a user who can change data on a green
screen can also change data through an FTP or ODBC
connection. While these exit programs can be written
in-house, regulatory compliance typically frowns upon
self-policing, so I strongly recommend evaluating a
commercial solution to selectively process and audit
user requests. Preventing data leaks is a requirement
shared between exit programs and object-level
security.
The PowerTech Group, Inc.
www.powertech.com • info@powertech.com
13 Tips to Write Secure Applications and Boost IBM i Security
C011SA4
12. Plan for High Availability
System availability is often a requirement of regulatory
compliance. Keeping systems running in the face of a
technological disaster is a popular business initiative and
one that continues to grow in popularity. When designing
a new application, consider the expectation that the
application may need to be replicated. A side-benefit
of journaling for HA purposes is the audit and recovery
trail that can be built into the application.
13. Query and Other Tools
When designing a security infrastructure, consider how
the application data will be accessed. Programs can use
adoption to temporarily access secured files, but other
tools may not have that luxury. Placing the invocation
command for a native tool (e.g., WRKQRY) inside a CL
“wrapper” can allow it to take advantage of the same
technique. Consider authorizing some generic profiles to
the authorization list to allow users to access data in a
limited capacity. For example, grant *USE access to a
profile named READONLY and then swap to that profile
if a user needs to use ODBC or Query to view the data.
If data is encrypted, native reports may have to be
authored if plain text viewing or reporting is required.
Summary
In my capacity as an auditor, I discover vulnerabilities
on hundreds of servers every year. In the vast
majority of cases, these servers are poorly configured
and are running applications that rely heavily on
legacy security mechanisms or have no security
considerations at all. Ironically, many of those same
organizations blame IBM for allowing users to extract
data, instead of taking responsibility and investing in
the design of a secure application.
Programmers are the linchpin when establishing
secure applications. Regardless of whether they’re
developing internal solutions or commercial products,
acknowledge the risk posed by not having their
cooperation, train them in security functions, and work
to obtain their buy-in regarding the fact that securing
an app is one of the most critical aspects of securing
data and maintaining compliance.

More Related Content

PPTX
Automate Data Scraping and Extraction for Web
PPTX
ROBOT and Banking on IBM i with Kevin Aker
PPTX
Getting Started with IBM i Security: Securing PC Access
PDF
Zero Trust And Best Practices for Securing Endpoint Apps on May 24th 2021
PPTX
Cs Comply And Audit V1.6
PPTX
Web application penetration testing
PPT
2009: Securing Applications With Web Application Firewalls and Vulnerability ...
PPT
IBM AppScan Standard - The Web Application Security Solution
Automate Data Scraping and Extraction for Web
ROBOT and Banking on IBM i with Kevin Aker
Getting Started with IBM i Security: Securing PC Access
Zero Trust And Best Practices for Securing Endpoint Apps on May 24th 2021
Cs Comply And Audit V1.6
Web application penetration testing
2009: Securing Applications With Web Application Firewalls and Vulnerability ...
IBM AppScan Standard - The Web Application Security Solution

What's hot (19)

PPT
IBM AppScan Source - The SAST solution
PPT
IBM AppScan Enterprise - The total software security solution
PPTX
Windows 7 Application Compatibility
PPT
Developing Secure Applications and Defending Against Common Attacks
PDF
Axoss Web Application Penetration Testing Services
PPT
Null Meet Ppt
PPT
Get Ready for Web Application Security Testing
PPTX
Windows 7 AppLocker: Understanding its Capabilities and Limitations
PDF
Technical Architecture of RASP Technology
PDF
The Complete Web Application Security Testing Checklist
PPTX
Cyber ark training
PPT
Security Testing
PDF
Closing Mainframe Integrity Gaps
PPT
Be Storm - Automated Application/Software Vulnerability Testing
PPTX
Hack through Injections
PDF
110006_perils_of_aging_emul_wp
PPTX
Application Explosion How to Manage Productivity vs Security
PDF
Security 101: Limiting Powerful User Profiles
PDF
Andrey Bogdanov, Dmitry Khovratovich, and Christian Rechberger
IBM AppScan Source - The SAST solution
IBM AppScan Enterprise - The total software security solution
Windows 7 Application Compatibility
Developing Secure Applications and Defending Against Common Attacks
Axoss Web Application Penetration Testing Services
Null Meet Ppt
Get Ready for Web Application Security Testing
Windows 7 AppLocker: Understanding its Capabilities and Limitations
Technical Architecture of RASP Technology
The Complete Web Application Security Testing Checklist
Cyber ark training
Security Testing
Closing Mainframe Integrity Gaps
Be Storm - Automated Application/Software Vulnerability Testing
Hack through Injections
110006_perils_of_aging_emul_wp
Application Explosion How to Manage Productivity vs Security
Security 101: Limiting Powerful User Profiles
Andrey Bogdanov, Dmitry Khovratovich, and Christian Rechberger
Ad

Viewers also liked (20)

PPTX
Time to Remove the Paper from Your Desk and Become More Efficient
PDF
Getting Started with IBM i Security: Integrated File System (IFS)
PPTX
Aging RPG Programmers in Charge of Your IBM i?
PPTX
Database 101 on IBM i
PDF
Vorschau 1 / 2010 V&R unipress
 
PPTX
Getting Started with IBM i Security: Event Auditing
PPTX
12 ssi bonprix
PDF
StandGuard Anti-Virus Tech Pack
PDF
Renovaciones y reservas Biblioteca Álvaro Cunqueiro Instituto Cervantes de Da...
PPT
Ahli United Bank
PDF
Range Magazine (2011: Issue 2)
PPTX
HERRAMIENTAS DEL INTERNET
PPT
Building your Brand Center with Athento -Smart Document Management-
DOC
Guia De Estudio Digestivo
PPT
Control charts tool
PDF
Curso IBM Redes SAN y Almacenamiento con Tivoli
PDF
Darktrace_WhitePaper_Needle_final
PPTX
Self Help Legal Software and Unauthorized Practice of Law
PPTX
Pssst... It's Time to get Rid of Pre-Printed Forms
PDF
Cinthya barzallo c-administracion-a
Time to Remove the Paper from Your Desk and Become More Efficient
Getting Started with IBM i Security: Integrated File System (IFS)
Aging RPG Programmers in Charge of Your IBM i?
Database 101 on IBM i
Vorschau 1 / 2010 V&R unipress
 
Getting Started with IBM i Security: Event Auditing
12 ssi bonprix
StandGuard Anti-Virus Tech Pack
Renovaciones y reservas Biblioteca Álvaro Cunqueiro Instituto Cervantes de Da...
Ahli United Bank
Range Magazine (2011: Issue 2)
HERRAMIENTAS DEL INTERNET
Building your Brand Center with Athento -Smart Document Management-
Guia De Estudio Digestivo
Control charts tool
Curso IBM Redes SAN y Almacenamiento con Tivoli
Darktrace_WhitePaper_Needle_final
Self Help Legal Software and Unauthorized Practice of Law
Pssst... It's Time to get Rid of Pre-Printed Forms
Cinthya barzallo c-administracion-a
Ad

Similar to 13 Tips to Write Secure Applications (20)

PPTX
Developing Secure IBM i Applications
PPTX
What Does a Full Featured Security Strategy Look Like?
PDF
Building a Secure Software Application: Your Ultimate Guide
PDF
Developing Dynamic PeopleSoft Field Security Applications:A PeopleSoft Develo...
PPS
Application Security Review 5 Dec 09 Final
PPT
Smart security solutions for SMBs
PDF
JavaOne2013: Secure Engineering Practices for Java
PDF
Secure Engineering Practices for Java
PPTX
Secure coding practices
PPTX
IBM i Security Best Practices
PPTX
CompTIASecPLUSAASS-part4 - Edited (1).pptx
PDF
IBM i Security Exposures Infographic
PPTX
Security Principles for CEOs
PDF
Webinar: Best Practices for Securing and Protecting MongoDB Data
ODP
CISSP Week 13
PPT
How PCI And PA DSS will change enterprise applications
PPTX
Ryan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja Warriors
PDF
IBM Security Software Solutions
PPTX
Forget cyber, it's all about AppSec
PPTX
5 Things Your Security Administrator Should Tell You
Developing Secure IBM i Applications
What Does a Full Featured Security Strategy Look Like?
Building a Secure Software Application: Your Ultimate Guide
Developing Dynamic PeopleSoft Field Security Applications:A PeopleSoft Develo...
Application Security Review 5 Dec 09 Final
Smart security solutions for SMBs
JavaOne2013: Secure Engineering Practices for Java
Secure Engineering Practices for Java
Secure coding practices
IBM i Security Best Practices
CompTIASecPLUSAASS-part4 - Edited (1).pptx
IBM i Security Exposures Infographic
Security Principles for CEOs
Webinar: Best Practices for Securing and Protecting MongoDB Data
CISSP Week 13
How PCI And PA DSS will change enterprise applications
Ryan Elkins - Simple Security Defense to Thwart an Army of Cyber Ninja Warriors
IBM Security Software Solutions
Forget cyber, it's all about AppSec
5 Things Your Security Administrator Should Tell You

More from HelpSystems (20)

PPTX
El Estado de la Seguridad de IBM i en 2020
PPTX
Ciberseguridad Cómo identificar con certeza dispositivos comprometidos en la...
PPTX
Rbt jdbc odbc webinar
PPTX
RPA en 45 minutos
PPTX
Webinar go anywhere_mft_scripts
PPTX
Automatización de Procesos de IT
PPTX
Hs 2020-ibmi-marketplace-spanish v3
PPTX
Mft 45 minutos
PPTX
Caso de éxito Zurich automatiza sus procesos críticos de Negocio con RPA
PPTX
Centro de Excelencia en Automatización 3
PPTX
Cómo crear un Centro de Excelencia de Automatización 2
PPTX
Construyendo un Centro de Excelencia de Automatización PARTE 1
PPTX
Webinar Vityl IT & Business Monitoring
PPTX
1 año de RGPD: 3 formas en las que HelpSystems puede ayudar
PPTX
Mft 45 minutos
PPTX
Automate feature tour
PPTX
WEBINAR GRABADO Automatización de procesos de IT: tecnologías más usadas, cas...
PPTX
5 problemas del intercambio de archivos mediante scripts
PPTX
CASO DE ÉXITO: Grupo Banco San Juan
PPTX
Webinar Security Scan
El Estado de la Seguridad de IBM i en 2020
Ciberseguridad Cómo identificar con certeza dispositivos comprometidos en la...
Rbt jdbc odbc webinar
RPA en 45 minutos
Webinar go anywhere_mft_scripts
Automatización de Procesos de IT
Hs 2020-ibmi-marketplace-spanish v3
Mft 45 minutos
Caso de éxito Zurich automatiza sus procesos críticos de Negocio con RPA
Centro de Excelencia en Automatización 3
Cómo crear un Centro de Excelencia de Automatización 2
Construyendo un Centro de Excelencia de Automatización PARTE 1
Webinar Vityl IT & Business Monitoring
1 año de RGPD: 3 formas en las que HelpSystems puede ayudar
Mft 45 minutos
Automate feature tour
WEBINAR GRABADO Automatización de procesos de IT: tecnologías más usadas, cas...
5 problemas del intercambio de archivos mediante scripts
CASO DE ÉXITO: Grupo Banco San Juan
Webinar Security Scan

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Cloud computing and distributed systems.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Encapsulation theory and applications.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Electronic commerce courselecture one. Pdf
Spectral efficient network and resource selection model in 5G networks
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
Cloud computing and distributed systems.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A comparative analysis of optical character recognition models for extracting...
Encapsulation theory and applications.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
sap open course for s4hana steps from ECC to s4
Digital-Transformation-Roadmap-for-Companies.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Network Security Unit 5.pdf for BCA BBA.
Review of recent advances in non-invasive hemoglobin estimation
Agricultural_Statistics_at_a_Glance_2022_0.pdf

13 Tips to Write Secure Applications

  • 1. WHITE PAPER TEL USA: 253-872-7788 TOLL FREE: +1 800-915-7700 TEL UK: +44 (0)870 120 3148 The PowerTech Group, Inc. www.powertech.com • info@powertech.com Copyright 2014. PowerTech is a Division of HelpSystems, LLC. All product and company names are trademarks of their respective holders. 13 Tips to Write Secure Applications and Boost IBM i Security By Robin Tatam Security. It surrounds every aspect of life in the new millennium, and it’s never going away. Human nature is such that any time we’re told there’s some- thing we shouldn’t do or somewhere we shouldn’t go, someone is always going to do exactly that and go precisely there. This is especially true when there’s something to gain by violating the rules. The proof? Barely a day passes without new headlines reporting another cyber attack, policy violation, or data breach. Secretly, we breathe a sigh of relief that it hap- pened to someone else, but most of us know that we’ll all eventually feel the impact in some capacity. Maybe it’ll manifest itself through increased bank fees, higher retail prices, or more hoops to jump through when we log in to our corporate firewall. And eventually it could—nay, it will—be us that it happens to. So who’s responsible for the security of an IBM i server and DB2 database? IBM builds the hardware and de- velops the operating system, application vendors and internal programmers write the business applications, and users maintain the corporate data. Who shoulders the responsibility for its integrity and its protection? After more than a decade of working as a security specialist, my answer is a resounding “EVERYONE!” IBM has done their part. Power Systems servers running IBM i™ have garnered an envious reputation for being some of the most securable servers on the planet, with numerous world-class integrity features. Notice I said securable instead of secure. The annual IBM i Security Study reports alarming statistics showing that most of these servers are operating with default—and largely open—security configurations. You would never assume a server running Windows is secure, and you should never assume it with one running IBM i. System users, such as programmers and administra- tors, should be managed by a combination of profile settings and good auditing controls. Application users should be managed by the applications. Ultimately, however, users will do whatever applications allow, not necessarily only what they’re designed to do. And it’s programmers who build those applications, so we have to talk about how to build a more secure application. The goal of this article is to identify important devel- opment considerations that will empower program- mers to enhance the security of our data rather than undermine it. Reprinted with permission of MC Press, LLC. All rights reserved. www.mcpressonline.com
  • 2. 13 Tips to Write Secure Applications and Boost IBM i SecurityThe PowerTech Group, Inc. www.powertech.com • info@powertech.com 1. Docu-what? Personal experience has taught me that documentation is a dirty word to many in the programming community. It hampers our simple desire to code. But documentation is also the map that guides future travelers. Without it, every enhancement and bug fix begins with a time- consuming discovery task and increases the likelihood that the application could be broken by the change. Before a single line of code is written, planning docu- ments should identify operational requirements such as these: • Application libraries • Profile ownership • Authorization lists • Authority schemes—public and private • Runtime attributes Documentation should also be embedded in the application programs. Comments should be clear, concise, and in plain English (or your language of choice). In other words, do not simply repeat what any programmer can read from looking at the code. 2. Segregate Libraries When building an application, many programmers lump all of the objects into a single library as it seems simpler on the surface. However, programs and files typically have different security requirements, and having them cohabit can make securing them more complicated. Segregating non-data objects and data objects into different libraries permits library-level security to control access. 3. “Softcode” Library Lists I was taught that hard-coding a library name into a program was a cardinal sin, but we’ve learned that search path manipulation is an easy way to wreak havoc and even circumvent security. An acceptable balance may be found by storing library names in data objects, such as data areas, so that they cannot be altered by users but can be changed without requiring modifications to the application code. 4. Own Your Objects Every object has an owner, and if you’ve ever had to delete a user’s profile, then you understand why ownership shouldn’t be retained by the programmer. Objects should never be owned by a group profile, especially one that consolidates the application users; each member would indirectly own the objects, giving them excess privileges. Instead, create a profile that has only one purpose in life: to own the application objects. Just remember, if new objects are created during the execution of the application, the program should also establish the correct ownership and authorities. Try to avoid assigning ownership to IBM- supplied profiles because if anyone—including IBM— makes a change to the profile, it might have an unpredictable impact on the application. 5. Design the Database Take time to classify the data in order to identify how stringent the access control should be. For a simple scheme, consider public, semi-public, and private. The database should be normalized to prevent information redundancy, and I recommend encrypting fields that are classified as private. Strong encryption functions are inherent within IBM i, and third-party providers can assist if code modification isn’t possible. Journaling is a popular technique that originated with application recovery and now has uses for replication and for auditing. Consider collecting before and after images of data changes in critical files and archiving that journal data according to corporate policy and compliance mandates. 6. Read the Menu Application menus were a solid approach to security back when terminal displays were the only way to access data. However, they fall flat on their face now that other interfaces exist that can facilitate direct access to the database. There’s nothing wrong with using menus to improve the user experience and to restrict user movement, but don’t rely on them to police data access. When a user steps outside the constraints of a menu, other controls such as command line restrictions, object-level security, and exit programs become even more critical.
  • 3. 13 Tips to Write Secure Applications and Boost IBM i SecurityThe PowerTech Group, Inc. www.powertech.com • info@powertech.com 7. Good Code While it seems obvious, write good code! My devel- opment career exposed me to some of the most horrendous applications I could imagine. Unwieldy programs with unmanageable top-down design, missing—or worse, inaccurate—comments, and redundant functions. Programs that are modular, concisely coded, and well-documented are easier to maintain and easier to review for unauthorized code modifications. ILE constructs make this easy. You should be taking advantage of them. 8. Public and Private Authority IBM i contains a unique concept known as *PUBLIC. This is the default level of access granted to a user who hasn’t been assigned a more specific access level. Many open configurations on servers running IBM i can be traced to the fact that IBM ships the default *PUBLIC authority level as *CHANGE, which is sufficient to read, change, and delete data in a file. Public authority is determined when the object is created from a parameter on the associated create command. By default, the command defers to a library attribute and that, in turn, defers to the QCRTAUT system value. I recommend setting the appropriate explicit value on the library as it allows different defaults to be used for each application library. The popular “deny by default” data access model calls for the public to be excluded, and the application users— or better yet, user groups—with a demonstrable need are granted private authority. 9. Authorization Lists Granting authority to hundreds or even thousands of individual objects can be an overwhelming admin- istrative chore. Authorization lists allow many objects to be addressed as a single entity and are a useful mechanism. A significant benefit of using lists is that authorities can be maintained while the associated objects are in use. This can be very beneficial in a 24/7 shop where obtaining object locks can be a monu- mental task. Just remember that *PUBLIC authority will come from the individual object unless you specify otherwise. 10. Adopted Authority and Profile Swapping Two techniques are available to allow a program to run with different authority than the user who invoked it. Instead of granting authority to individuals or even groups, authority can be elevated temporarily while the program is running, alleviating the requirement to grant authority to the users themselves. In the case of adoption, a runtime attribute on the program object controls the inheritance. Both special and private authority is culled from the owner of the program, which is beneficial if following the recommendation of using a unique profile for ownership. Profile swapping allows a user to assume the identity of another and is accomplished via calls to several easy-to-use IBM-supplied APIs. Both approaches have pros and cons, and more detailed information can be found using your search engine of choice. Overall, these are two of the most useful functions in a security- conscious programmer’s toolbox. 11. Cover Your Exits IBM i contains a registry of exit points, which are almost like subroutines in the OS’s functions. When a function is invoked, the OS can pass control temp- orarily to the assigned exit program—if one exists— to perform any ancillary task before the OS resumes control and processes the request. There are dozens of exit points in several different categories, but about 30 of them pertain to network access and should be considered critical. While object- level security remains effective during these requests, the OS can only enforce one setting across all inter- faces, so a user who can change data on a green screen can also change data through an FTP or ODBC connection. While these exit programs can be written in-house, regulatory compliance typically frowns upon self-policing, so I strongly recommend evaluating a commercial solution to selectively process and audit user requests. Preventing data leaks is a requirement shared between exit programs and object-level security.
  • 4. The PowerTech Group, Inc. www.powertech.com • info@powertech.com 13 Tips to Write Secure Applications and Boost IBM i Security C011SA4 12. Plan for High Availability System availability is often a requirement of regulatory compliance. Keeping systems running in the face of a technological disaster is a popular business initiative and one that continues to grow in popularity. When designing a new application, consider the expectation that the application may need to be replicated. A side-benefit of journaling for HA purposes is the audit and recovery trail that can be built into the application. 13. Query and Other Tools When designing a security infrastructure, consider how the application data will be accessed. Programs can use adoption to temporarily access secured files, but other tools may not have that luxury. Placing the invocation command for a native tool (e.g., WRKQRY) inside a CL “wrapper” can allow it to take advantage of the same technique. Consider authorizing some generic profiles to the authorization list to allow users to access data in a limited capacity. For example, grant *USE access to a profile named READONLY and then swap to that profile if a user needs to use ODBC or Query to view the data. If data is encrypted, native reports may have to be authored if plain text viewing or reporting is required. Summary In my capacity as an auditor, I discover vulnerabilities on hundreds of servers every year. In the vast majority of cases, these servers are poorly configured and are running applications that rely heavily on legacy security mechanisms or have no security considerations at all. Ironically, many of those same organizations blame IBM for allowing users to extract data, instead of taking responsibility and investing in the design of a secure application. Programmers are the linchpin when establishing secure applications. Regardless of whether they’re developing internal solutions or commercial products, acknowledge the risk posed by not having their cooperation, train them in security functions, and work to obtain their buy-in regarding the fact that securing an app is one of the most critical aspects of securing data and maintaining compliance.