03
Sun, Mar
0 New Articles

Object Security by Adoption

IBM i (OS/400, i5/OS)
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

No discussion of OS/400 security could be complete without mentioning adopted authority. This article does much more than mention it; this article describes adopted authority and lists some of its advantages and some dangers inherent to its use.

Of all the tricks available in OS/400 security, adopted authority is high among the trickiest. It is not surprising, then, that some security administrators have trouble dealing with it. In this article, you’ll learn the basics of adopted authority and become aware of not only its advantages, but also its pitfalls.

Every OS/400 object has an owner. Initially, the owner of an object is the user who creates it; later, ownership of an object can be transferred to another user by using the Change Object Owner (CHGOBJOWN) command. Initially, the owner of an object has *ALL authority to the object; this means that the owner can use the object, change it in any way he wants, and even delete the object from the system.

When the object is a program (*PGM), service program (*SRVPGM), or SQL package (*SQLPKG), object ownership takes an additional meaning—whether to adopt authorities or not. I’ll explain what this means by way of an example.

The General Idea

Imagine an interactive RPG program named PGM1 that uses two files: FILEA and FILEB. Any user can call PGM1 because its public authority is set to *USE, and no user can access either file because their information is confidential; the security administrator has given *EXCLUDE authority to the public. This means that if a user who has not been explicitly given access to the files calls program PGM1, the program will begin to initiate but then bomb as soon as it attempts to open the files. Why? Because the user has *EXCLUDE authority, courtesy of the public authority.

There may be valid reasons for keeping public authority set to *EXCLUDE. For example, one of the files could be the employee master file, the other a history of year-to- date deductions taken from employee paychecks. How do you solve the problem?

Here are two options:
• Give users (who have been authorized by management) whatever authority they need to run PGM1 successfully. Perhaps user A needs *CHANGE authority if she maintains the employee master file, while user B needs only *USE if all he ever does is look at the file without altering anything.

• Transfer ownership of PGM1 to a user who has enough authority to both database files and then set PGM1 so it adopts the authority of its owner.

The first option is the most secure, but (not surprisingly) it is also the most complicated. If you keep using this method, user profiles will soon have hundreds of objects to which they are explicitly authorized in one way or another. You can reduce the clutter somewhat by careful use of authorization lists or group profiles (or both), but doing that just adds one more layer of complexity that obscures the overall structure of your AS/400 security.

The second option is less secure, but it is the simplest to implement. If user C has *CHANGE authority to both FILEA and FILEB, C can become the owner of PGM1. Then, when you change PGM1 to adopt authority from its owner, any user running PGM1 will automatically be given temporary authorization to both files. As soon as PGM1 ends, the user immediately loses his authorization to the files. If you’re wondering why adopted authority is less secure, keep reading. I’ll get to that later.

System Value QUSEADPAUT

Simply put, QUSEADPAUT tells the system who can create programs that adopt authority. This system value is available only on OS/400 V3R6 or higher.

QUSEADPAUT stores an authorization list name (object type *AUTL), but the AS/400 is shipped to you with this system value set to *NONE. With *NONE, any user who can create programs can create them so they adopt authority from their owners. If you supply an authorization list name in this system value, however, the only users who can create programs that adopt authority are the users who have authority to the authorization list.

It sounds complicated (and the repeated use of the words authority and authorization does nothing to make it more clear), but actually it’s rather simple. Suppose you create an authorization list named ADPAUT, give the public *EXCLUDE authority, and give users PGMR1 and PGMR2 *USE authority. Then, you change system value QUSEADP-AUT to ADPAUT. From that point on, only PGMR1 and PGMR2 can create programs that adopt authority. Of course, users who enjoy *ALLOBJ special authority can override the *EXCLUDE authority given the public; therefore, *ALLOBJ users can also create programs that adopt authorities.

Creating the Programs

For a program to adopt authorities from its owner, two things must happen first: The program must be owned by a user who has the authority you want to adopt, and the program must have been created with USRPRF(*OWNER).

All CRTxxxPGM commands—even Create Program (CRTPGM) and Create Service Program (CRTSRVPGM)—have a USRPRF parameter. By default, its value is *USER; this value means that the program uses the authorities granted to the user who is running it. The value *OWNER, on the other hand, tells the system to adopt the authorities of the owner of the program.

You may forget to set USRPRF to *OWNER. If you do, run Change Program (CHGPGM) or Change Service Program (CHGSRVPGM); both commands also have a USRPRF parameter.

Adopted authorities are automatically propagated to programs you call from a program compiled with USRPRF(*OWNER). So, if PGM1 adopts authorities and calls PGM2, PGM2 also adopts authorities, even if it was compiled with USRPRF(*USER). If this state of affairs is undesirable, you can change PGM2 (with the CHGPGM command) to USEADPAUT(*NO). This way, PGM2 will not adopt authorities.

Advantages of Adopting Authority

Besides the obvious advantages, such as greatly simplifying security administration, the technique of adopting authorities offers an excellent advantage in systems that use Client Access/400. If OS/400 didn’t offer adopted authorities, you would have to give a user the highest authority he is ever going to need to do his job well. That might mean giving him *CHANGE access to the employee master file, just because he occasionally runs a program to change emergency contact information on employee records.

Suppose this user accesses the AS/400 via Client Access. He can, then, start only the router and then start a remote command that runs a program he wrote to increase his wages a bit. With *CHANGE authority to the file, he can do it.

Adopting authorities changes all that. You can give this user *USE authority and then change the program he runs to maintain contact information, making it adopt *CHANGE authority from the owner. This technique accomplishes two things: First, it prevents unwanted access from Client Access sessions; second, it prevents unwanted access from other programs the user may write. Only when the program that adopts authority is running is the user able to change information in the employee file—and in the specific (and restricted) way in which the programmer has coded it.

Here’s another, similar advantage: If you have users who routinely use SQL, you can keep them from using anything but the SELECT statement. To do so, give these users *USE authority to the files you want to protect, and then change all programs that require higher authority so they adopt authorities from their owners.

Pitfalls, Too!

You must not think, however, that adopting authorities is a universal remedy to all your security-related troubles. In fact, if not used properly, adopting authorities may make matters worse. Here are a couple of troublesome scenarios. I hope they give you a chill.

First, imagine that program PGM1 adopts authorities and calls PGM2. Because of the way OS/400 works, PGM2 will also adopt authorities, even if compiled with USRPRF(*USER), because it has been called by a program that adopts. PGM1 adopts authorities from a user who has *ALLOBJ special authority, and the call to PGM2 is not qualified with a library name; the system uses the library list to find PGM2.

A resourceful user may create a clone of QSYS/QCMD, or build a “shell” around it, name it PGM2, and place it in a library higher than that which contains the real PGM2. When the user calls PGM1 and PGM1 eventually calls PGM2, he’ll get a Command Entry panel, if that’s what he created his “shell” to do. From this, he’ll be able to run any command and do everything the user profile with the higher authority could, thanks to the *ALLOBJ authority he’s adopting from the owner of PGM1. There you have a textbook example of a Trojan horse (for another example of a Trojan horse scenario, see “Are Your AS/400 Passwords Really Secure?” also in this issue of MC).

Or how about this? A user runs CL program CLP1, which adopts authority. CLP1 then adds library LIBA to the library list. LIBA contains file DB1, and the user is not specifically authorized to either the library or the file. No matter: Because CLP1 adopts authority, he’ll have access to DB1. Later, CLP1 ends without removing LIBA from the library list. Even though CLP1 has ended and the user is not running under adopted

authorities, the user still has authorization to file DB1. This one is really weird! It’s documented in the AS/400 Advanced Series: Security Reference manual, too.

There’s another gotcha, too. If you create PGM1 and then re-create it (say, after debugging it), the new version of the program will have the same USRPRF setting the old version had—the value of the USRPRF parameter in the compilation command is ignored. You must delete the original program object before re-creating it or use the CHGPGM command to alter the new version after compilation is complete.

Control Tools

To be sure, OS/400 gives you many tools to help you control adopted authorities. First is the Display Programs that Adopt (DSPPGM-ADP) command, which does exactly what its name implies: It creates a list of programs that adopt authorities. Or, instead of the command, you can use the QSYLOBJP API .

Second, you can use Display Program (DSPPGM) or Display Service Program (DSPSRVPGM) to check whether a specific program adopts authorities from its owner.

Third, system value QALWOBJRST controls which security-sensitive objects may be restored into your system. If the system value contains either *ALL or *ALWPGMADP, a user with enough authority may restore a program that adopts authorities. Since QALWOBJRST must be set to *ALL prior to some system-level activities (such as installing OS/400 or applying PTFs), you must remember to set QALWOBJRST back to its former value.

Finally, OS/400 has an incredibly rich auditing feature. If you set system value QAUDLVL to *PGMADP or if you set a user profile’s AUDLVL setting to *PGMADP, OS/400 will write a journal entry every time adopted authority is used to gain access to an object. You can then check the journal to determine whether your system’s security is full of holes. Look for journal entries of type AP. A subtype of S indicates that a program that adopts authority has started. A subtype of E indicates that it ended, and an A indicates that adopted authority was used during the activation of the program. The model outfile is QASYAPJE in all cases.

Use It Wisely

Properly used, adopted authority can be a tremendous addition to your security administration policies. I hope that you have learned useful concepts and that you will take care when employing the techniques presented here.

Reference

AS/400 Advanced Series: Security Reference (SC41-4302-01, CD-ROM QBJALC01)

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: