homepage
Open menu
Go one level top
  • Train and Certify
    Train and Certify

    Immediately apply the skills and techniques learned in SANS courses, ranges, and summits

    • Overview
    • Courses
      • Overview
      • Full Course List
      • By Focus Areas
        • Cloud Security
        • Cyber Defense
        • Cybersecurity and IT Essentials
        • DFIR
        • Industrial Control Systems
        • Offensive Operations
        • Management, Legal, and Audit
      • By Skill Levels
        • New to Cyber
        • Essentials
        • Advanced
        • Expert
      • Training Formats
        • OnDemand
        • In-Person
        • Live Online
      • Course Demos
    • Training Roadmaps
      • Skills Roadmap
      • Focus Area Job Roles
        • Cyber Defence Job Roles
        • Offensive Operations Job Roles
        • DFIR Job Roles
        • Cloud Job Roles
        • ICS Job Roles
        • Leadership Job Roles
      • NICE Framework
        • Security Provisionals
        • Operate and Maintain
        • Oversee and Govern
        • Protect and Defend
        • Analyze
        • Collect and Operate
        • Investigate
        • Industrial Control Systems
    • GIAC Certifications
    • Training Events & Summits
      • Events Overview
      • Event Locations
        • Asia
        • Australia & New Zealand
        • Latin America
        • Mainland Europe
        • Middle East & Africa
        • Scandinavia
        • United Kingdom & Ireland
        • United States & Canada
      • Summits
    • OnDemand
    • Get Started in Cyber
      • Overview
      • Degree and Certificate Programs
      • Scholarships
    • Cyber Ranges
  • Manage Your Team
    Manage Your Team

    Build a world-class cyber team with our workforce development programs

    • Overview
    • Why Work with SANS
    • Group Purchasing
    • Build Your Team
      • Team Development
      • Assessments
      • Private Training
      • Hire Cyber Professionals
      • By Industry
        • Health Care
        • Industrial Control Systems Security
        • Military
    • Leadership Training
  • Security Awareness
    Security Awareness

    Increase your staff’s cyber awareness, help them change their behaviors, and reduce your organizational risk

    • Overview
    • Products & Services
      • Security Awareness Training
        • EndUser Training
        • Phishing Platform
      • Specialized
        • Developer Training
        • ICS Engineer Training
        • NERC CIP Training
        • IT Administrator
      • Risk Assessments
        • Knowledge Assessment
        • Culture Assessment
        • Behavioral Risk Assessment
    • OUCH! Newsletter
    • Career Development
      • Overview
      • Training & Courses
      • Professional Credential
    • Blog
    • Partners
    • Reports & Case Studies
  • Resources
    Resources

    Enhance your skills with access to thousands of free resources, 150+ instructor-developed tools, and the latest cybersecurity news and analysis

    • Overview
    • Webcasts
    • Free Cybersecurity Events
      • Free Events Overview
      • Summits
      • Solutions Forums
      • Community Nights
    • Content
      • Newsletters
        • NewsBites
        • @RISK
        • OUCH! Newsletter
      • Blog
      • Podcasts
      • Summit Presentations
      • Posters & Cheat Sheets
    • Research
      • White Papers
      • Security Policies
    • Tools
    • Focus Areas
      • Cyber Defense
      • Cloud Security
      • Digital Forensics & Incident Response
      • Industrial Control Systems
      • Cyber Security Leadership
      • Offensive Operations
  • Get Involved
    Get Involved

    Help keep the cyber community one step ahead of threats. Join the SANS community or begin your journey of becoming a SANS Certified Instructor today.

    • Overview
    • Join the Community
    • Work Study
    • Teach for SANS
    • CISO Network
    • Partnerships
    • Sponsorship Opportunities
  • About
    About

    Learn more about how SANS empowers and educates current and future cybersecurity practitioners with knowledge and skills

    • SANS
      • Overview
      • Our Founder
      • Awards
    • Instructors
      • Our Instructors
      • Full Instructor List
    • Mission
      • Our Mission
      • Diversity
      • Scholarships
    • Contact
      • Contact Customer Service
      • Contact Sales
      • Press & Media Enquiries
    • Frequent Asked Questions
    • Customer Reviews
    • Press
    • Careers
  • Contact Sales
  • SANS Sites
    • GIAC Security Certifications
    • Internet Storm Center
    • SANS Technology Institute
    • Security Awareness Training
  • Search
  • Log In
  • Join
    • 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
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
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
Macedonia
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
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
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
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
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
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

  • SEC511: Continuous Monitoring and Security Operations
  • SEC450: Blue Team Fundamentals: Security Operations and Analysis
  • SEC401J: Security Essentials - Network, Endpoint & Cloud - Japanese

Tags:
  • Cloud Security
  • Security Management, Legal, and Audit

Related Content

Blog
CD_Blog_HowtoautomateinAzure_Part1_2.jpg
Cyber Defense, Cloud Security
October 11, 2022
How to Automate in Azure Using PowerShell - Part 1
In this post, we’ll cover how to automate the assessment and reporting of your cloud security configuration opportunities.
370x370_josh-johnson.jpg
Josh Johnson
read more
Blog
SOC2-340x340.png
Security Management, Legal, and Audit
April 7, 2022
SANS SOC 2 Resources
Stay current with free resources focused on SOC 2.
MGT_Triad_370x370_Headshot.jpg
SANS Cybersecurity Leadership
read more
Blog
Compliance-340x340.png
Security Management, Legal, and Audit, Cloud Security
July 12, 2021
Why You Need Automation to Achieve Compliance in the Cloud - Part 1
Part 1 of 3
370x370_AJ-Yawn_CloudSEcNext.jpg
AJ Yawn
read more
  • Register to Learn
  • Courses
  • Certifications
  • Degree Programs
  • Cyber Ranges
  • Job Tools
  • Security Policy Project
  • Posters & Cheat Sheets
  • White Papers
  • Focus Areas
  • Cyber Defense
  • Cloud Security
  • Cybersecurity Leadership
  • Digital Forensics
  • Industrial Control Systems
  • Offensive Operations
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
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
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
Macedonia
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
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
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
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
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
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.
  • © 2023 SANS™ Institute
  • Privacy Policy
  • Contact
  • Careers
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn