homepage
Menu
Open menu
  • Training
    Go one level top Back

    Training

    • Courses

      Build cyber prowess with training from renowned experts

    • Hands-On Simulations

      Hands-on learning exercises keep you at the top of your cyber game

    • Certifications

      Demonstrate cybersecurity expertise with GIAC certifications

    • Ways to Train

      Multiple training options to best fit your schedule and preferred learning style

    • Training Events & Summits

      Expert-led training at locations around the world

    • Free Training Events

      Upcoming workshops, webinars and local events

    • Security Awareness

      Harden enterprise security with end-user and role-based training

    Featured

    Get a Free Hour of SANS Training

    Free Course Demos

    Can't find what you are looking for?

    Let us help.
    Contact us
  • Learning Paths
    Go one level top Back

    Learning Paths

    • By Focus Area

      Chart your path to job-specific training courses

    • By NICE Framework

      Navigate cybersecurity training through NICE framework roles

    • DoDD 8140 Work Roles

      US DoD 8140 Directive Frameworks

    • By European Skills Framework

      Align your enterprise cyber skills with ECSF profiles

    • By Skills Roadmap

      Find the right training path based on critical skills

    • New to Cyber

      Give your cybersecurity career the right foundation for success

    • Leadership

      Training designed to help security leaders reduce organizational risk

    • Degree and Certificate Programs

      Gain the skills, certifications, and confidence to launch or advance your cybersecurity career.

    Featured: Solutions for Emerging Risks

    New to Cyber resources

    Start your career
  • Community Resources
    Go one level top Back

    Community Resources

    Watch & Listen

    • Webinars
    • Live Streams
    • Podcasts

    Read

    • Blog
    • Newsletters
    • White Papers
    • Internet Storm Center

    Download

    • Open Source Tools
    • Posters & Cheat Sheets
    • Policy Templates
    • Summit Presentations
    • SANS Community Benefits

      Connect, learn, and share with other cybersecurity professionals

    • CISO Network

      Engage, challenge, and network with fellow CISOs in this exclusive community of security leaders

  • For Organizations
    Go one level top Back

    For Organizations

    Team Development

    • Why Partner with SANS
    • Group Purchasing
    • Skills & Talent Assessments
    • Private & Custom Training

    Leadership Development

    • Leadership Courses & Accreditation
    • Executive Cybersecurity Exercises
    • CISO Network

    Security Awareness

    • End-User Training
    • Phishing Simulation
    • Specialized Role-Based Training
    • Risk Assessments
    • Public Sector Partnerships

      Explore industry-specific programming and customized training solutions

    • Sponsorship Opportunities

      Sponsor a SANS event or research paper

    Interested in developing a training plan to fit your organization’s needs?

    We're here to help.
    Contact us
  • Talk with an expert
  • Log In
  • Join - it's free
  • Account
    • Account Dashboard
    • Log Out
  1. Home >
  2. Blog >
  3. Why You Need Automation to Achieve Compliance in the Cloud - Part 2
370x370_AJ-Yawn_CloudSEcNext.jpg
AJ Yawn

Why You Need Automation to Achieve Compliance in the Cloud - Part 2

Part 2 of 3

August 9, 2021

Read Part 1 of the series here.

This blog is the 2nd of a 3-part series on why automation is necessary for cybersecurity compliance in modern cloud environments. This blog posts supplement the material presented in #2 of the free webcast series:

  1. Why You Need Automation to Achieve Compliance in the Cloud
  2. Leveraging OSQuery for Compliance - A Recovering Auditor’s Perspective
  3. An Easier Way to Multi-cloud, Multi-account Cloud Compliance

A fundamental tenet we discussed in part 1 of this series was that compliance professionals should live off the land and use ubiquitous tools to facilitate compliance checks. By using tools that your administrators are using, compliance checks will be completed by those same administrators. This makes compliance professionals more efficient - and probably more liked by their co-workers in the operations and engineering departments.

In part 2 of this series, we are diving into osQuery from a compliance perspective.

What is OSQuery?

According to the osquery docs page,

"osquery is an operating system instrumentation framework for Windows, OS X (macOS), Linux, and FreeBSD. The tools make low-level operating system analytics and monitoring both performant and intuitive.

osquery exposes an operating system as a high-performance relational database. This allows you to write SQL queries to explore operating system data. With osquery, SQL tables represent abstract concepts such as running processes, loaded kernel modules, open network connections, browser plugins, hardware events or file hashes."

There are some critical aspects of the definition above that are essential to understand and dive into. The first aspect of osquery that makes this a robust security and compliance tool is that it works on Windows, OS X, Linux, and FreeBSD. The cross-platform capabilities of osquery make the tool valuable in modern environments. In my career, I have performed hundreds (maybe thousands?) of cybersecurity audits and assessments. I can confidently say that I have never seen an organization that exclusively uses one type of operating system. Generally, you come across a mix of Linux, Windows, or macOS, making compliance activities difficult. osquery takes that complexity away by allowing you to write queries across different operating systems to obtain relevant security and compliance data. Modern organizations require solutions that are operating system agnostic, and osquery accomplishes this.

Secondly, osquery exposes the operating system as a high-performance relational database that allows administrators to write SQL queries to obtain valuable data. Even if you're not a SQL expert, it is easy to start and begin writing queries quickly. Everything you do with osquery is centered around SQL and its expressive nature to gather endpoint data rapidly and efficiently. In the webinar linked above, I review and demo some of the basics of osquery that can help you get started.

There are two ways to run osquery once you have it installed on your system. The first is using the interactive SQL console - osqueryi - to run ad hoc queries locally on a system. You run this at the command line on the system. For example, incident handlers use this frequently to conduct ad hoc forensics or incident response activities. The screenshots below are from the osqueryi interactive shell. The second way to run osquery is using the osquery daemon, which allows you to run queries against remote systems. This is useful if you have many systems and would like to run and schedule the same queries against multiple systems at once. In addition, this daemon (or service on Unix) accepts remote requests, which is very useful for enterprise compliance at scale.

So What Does This Mean for Compliance?

As of writing this blog post, there are over 275 tables available for security professionals to explore. That's a lot of tables! The cool thing about osquery is that it is open-source, and there is a massive community behind its development and growth. There are a few valuable tables that we have found to be useful for compliance activities and data gathering.

As we explore some of the tables and queries below, we will outline the schema of each table, an example query, and example results. During the webinar and in SEC557, we dive deeper into writing queries and utilizing osquery in your enterprise environment.

Cross-Platform Tables

As mentioned above, one of the great benefits of osquery is running the same queries against different operating systems. As of writing this blog, there are 50 cross-platform tables available for security professionals. In addition, there are a few tables we found helpful for compliance activities:

OS Version Table

The OS version table allows you to obtain information about the installed operating system, including helpful information such as install date, build number, codename.

image_(1).png

Users, Groups, and user_groups

The users and groups tables contain information about local users and groups. The users' table contains information and domain accounts that have logged on locally on Windows systems. The user_groups table map local users into local groups, outlining user group relationships and performing SQL JOIN operations on the table.

Users

image_(2).png

Groups

image_(3).png

User_groups

image_(4).png

Listening ports

The listening ports table outlines processes with listening network sockets and ports. This table exposes open TCP and UDP ports as well as the process ID. Providing the process ID lets you check your processes table and gather additional information about the processes running.

image_(5).png

File

The file table allows you to access files on the filesystem host. This table is great because it contains many metadata attributes that can be utilized when building queries. However, the file table does require a WHERE clause, so you need to know where the file is before you query it. It is not practical or efficient for osquery to search every directory and subdirectory on the system.

image_(6).png

Windows Tables

Currently, there are 102 Windows-specific tables available for security professionals. However, the below tables can be helpful to compliance professionals for audits and ongoing monitoring of their environments:

Programs

The programs table includes information on programs installed on the system, including helpful information such as the version and install_date. This data is valuable in performing a compliance check against the CIS Critical Security Control 2 Inventory and Control of Software Assets. In SEC557, we use Powershell as our language of choice for compliance automation. Powershell is great, but a few osquery tables provide similar or more robust data than the equivalent Powershell query. For example, the 'Get-CIMInstance win32_product' query does not provide as many programs as the programs table does on osquery. It's helpful to understand these limitations and offer multiple options to administrators performing these compliance checks. Some fields within this table may be blank as Windows installation details are left to the discretion of the author of the software product.

image_(7).png

Patches

The patches table includes all the patches applied to the system. This table provides equivalent results of the 'Get-Hotfix' Powershell cmdlet that we covered in this series's part 1 blog post. For compliance, you may need to prove that you have a particular patch installed on systems. For example, you could conduct a query of all systems that are missing a specific patch installed. There is a limitation here as this table does not include patches applied via MSI or downloaded from Windows Update (e.g., Service Packs).

image_(8).png

Services

The services table provides details of all installed Windows services and their relevant data, including the process ID, path, start_type, and much more. This table offers roughly the same results as the 'Get-Service' cmdlet from Powershell.

image_(1).png

Linux tables

Lastly, we have a whopping 157 Linux-specific tables available for security professionals. That's a lot of tables to explore. However, the below tables are a few that we find extremely useful for compliance data gathering activities:

Kernel_info

The kernel_info table includes basic active kernel information, including the kernel version.

image_(9).png

Kernel_modules

The kernel_modules table includes data about installed and running kernel modules that are both loaded and within the load search path.

image_(10).png

Disk_encryption

The disk encryption table includes disk encryption status and information.

image_(11).png

Suid_bin

The suid_bin table contains information about executables with the SUID and SGID (privilege escalation) bit set. This is a beneficial compliance check when determining if an organization has implemented the principle of least privilege.

image_(12).png

Conclusion

Compliance professionals should leverage osquery to help automate compliance in enterprise and cloud environments. Understanding the tools your administrators use to perform security tasks enables compliance professionals to speak the same language as the rest of the security organization. A core tenet of the automating compliance philosophy in SEC557 is living off the land and using ubiquitous tools to perform compliance checks. This mindset puts compliance professionals on the same playing field as their counterparts in the organization implementing agile and DevSecOps principles.

Share:
TwitterLinkedInFacebook
Copy url Url was copied to clipboard
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Cote D'ivoire
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Eswatini
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Macedonia
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania, United Republic Of
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City State
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Recommended Training

  • SEC599: Defeating Advanced Adversaries - Purple Team Tactics & Kill Chain Defenses™
  • SEC573: Automating Information Security with Python™
  • SEC560: Enterprise Penetration Testing™

Tags:
  • Cloud Security
  • Cybersecurity Leadership

Related Content

Blog
SEC540_Updated_340x340.png
Cloud Security
December 29, 2023
What is the SANS Cloud Flight Simulator?
Get ready for takeoff into the NEW SEC540!
Eric_Johnson_370x370.png
Eric Johnson
read more
Blog
Rethinking_Compliance_340x340.png
Cloud Security
October 10, 2023
Rethinking Cybersecurity Compliance: The Underutilized Power of CSP Native Security Services
Live off the land for cloud compliance
370x370_AJ-Yawn_CloudSEcNext.jpg
AJ Yawn
read more
Blog
SSA_-_Blog_-_Building_a_Cybersecurity_and_Privacy_Learning_Program_-_340x340.jpg
Cybersecurity Leadership, Security Awareness
September 12, 2023
NIST’s SP800-50r1 – Building a Cybersecurity and Privacy Learning Program
Overall, this document is really about defining and meeting training requirements.
370x370_Lance-Spitzner.jpg
Lance Spitzner
read more
  • Company
  • Mission
  • Instructors
  • About
  • FAQ
  • Press
  • Contact Us
  • Careers
  • Policies
  • Training Programs
  • Work Study
  • Academies & Scholarships
  • Public Sector Partnerships
  • Law Enforcement
  • SkillsFuture Singapore
  • Degree Programs
  • Get Involved
  • Join the Community
  • Become an Instructor
  • Become a Sponsor
  • Speak at a Summit
  • Join the CISO Network
  • Award Programs
  • Partner Portal
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Cote D'ivoire
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Eswatini
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
North Macedonia
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania, United Republic Of
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City State
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Zambia
Zimbabwe

By providing this information, you agree to the processing of your personal data by SANS as described in our Privacy Policy.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
  • Privacy Policy
  • Terms and Conditions
  • Do Not Sell/Share My Personal Information
  • Contact
  • Careers
© 2025 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute. Our Terms and Conditions detail our trademark and copyright rights. Any unauthorized use is expressly prohibited.
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn