SlideShare a Scribd company logo
Course 1: Overview of Secure
Programming, Section 5
Pascal Meunier, Ph.D., M.Sc., CISSP
May 2004; updated January 12, 2006
Developed thanks to support and contributions from Symantec
Corporation, support from the NSF SFS Capacity Building Program
(Award Number 0113725) and the Purdue e-Enterprise Center
Copyright (2004) Purdue Research Foundation. All rights reserved.
Course 1 Learning Plan


     Security overview and patching
     Public vulnerability databases and resources
     Secure software engineering
     Security assessment and testing
     Shell and environment
     Resource management
     Trust management
Learning objectives


   Understand how shells interpret commands, launch
    and provide environments for processes
     – Understand how setuid or LocalSystem scripts and
       programs are risky
   Understand how environments affect the security of
    applications
   Understand how configuration issues affect the
    security of applications
   Understand security issues in audit logs
   Understand security issues in launching processes
Operations Management and Best Practices


   Shells
   Environment
   Configuration
   Logging
   Calling External Programs
Shells: Outline


     What is a shell?
     Relative path vulnerabilities and mini-lab
     Substitutions
     Setuid scripts and programs
What is a shell?


   Launches programs, including other shells
   Provides
     – Capabilities to applications
     – A user interface
   Windows Explorer shell
   Replacement Windows shells
     – Geoshell
     – Aston, etc...
     – Norton Desktop for Windows
   UNIX shells
     – bash
     – tcsh, etc...
Capabilities provided by Windows shells


   Custom url handlers
     – Clicking on a url "outlook://" starts outlook
     – Buffer overflow when handling custom urls of improperly
       removed applications (CVE-2002-0070; MS02-014)
   UI preferences
     – Buffer overflow when handling desktop.ini (CVE-2003-
       0306; MS03-27)
   Path resolution and handling
     – Relative shell path vulnerability in Windows 2000 and NT
       (CVE-2000-0663)
         Run Explorer.exe trojan from another user
   Various means of launching other programs
     – Buffer overflows (CVE-2002-1327, CVE-2003-0503)
Capabilities of UNIX shells


   Substitutions
     – Filename substitution (wildcard expansion, a.k.a. globbing)
     – Command substitution
          bash and tcsh interpret backticks in names (CVE-1999-
           1383)
          Arbitrary command execution in GhostView handling of file
           names (CVE-2002-1569) (BID 5840)
          Several other applications invoke shell capabilities!
   Environment variables
     – PATH search variable
   File system path resolution
   Launching applications
Relative Path Vulnerabilities


   Relative paths trigger a search for the actual file. Is
    it:
     – In the current directory?
     – In some other directory specified by the PATH
       environment variable?
     – Which one of the above two should be done first?
          Insecure default in Windows (see next slide)
   ICAT: 15 entries (Windows, UNIX, others)
   Common misconfiguration of UNIX accounts
   Mini-Lab
Windows PATH


  Different behavior depending on version of
   Windows
    – Old behavior: current directory was searched first for
      DLLs
    – New behavior: search all system locations first
         XP SP1
         Windows 2003
    – More secure, but...
  The current directory is searched even if "." is not
   in your PATH, and searched before your PATH!
    – Insecure default
    – You may not get the DLL (dynamically loaded library) you
      wanted!      (see Howard and Leblanc 2003)
Windows Filename Extensions


   What if you didn't specify the extension?
   The environment variable PATHEXT decides the
    order (.com, .exe, .bat, .cmd, ...)
   What if PATHEXT is changed by a malicious user,
    so a trojan would run instead?
   Other ambiguities
     – Trailing dot, slash in filename
     – Long vs short name
     – Canonicalization issues covered in course 2, part 7
       "Canonicalization and Directory Traversal"
   Solution: Use the absolute path and complete
    name
Shell Mini-Lab (Windows)


   Open a command prompt
    – Type “command” within the window you opened. Which
      shell is running now? Now type “exit”
    – Type “cd“ or “set %CD%”. What is the current directory?
    – Type “set PATH". What is the meaning of the output?
    – Create a cmd file named “cmd.cmd":
        echo @echo gotcha > cmd.cmd
    – Compare the execution of “cmd" and ".cmd". What is
      the difference, if any?
    – Type "set PATH=%PATH%;.". What effect does it have
      when you run “cmd”?
    – Create a batch file named “cmd.bat”:
        echo @echo hello > cmd.bat
Shell Mini-Lab (Windows continued)


   What happens when you run “cmd” now?
     – How can you change the behavior?
   Compare the results of running “cmd” with the
    results of running
    “%SYSTEMROOT%system32cmd”.
   What kind of path is
    “%SYSTEMROOT%system32cmd”?
   Type “%SYSTEMDRIVE%”
   Type “cd %SYSTEMROOT%system32”
   Compare the results of running “cmd” and “.cmd”.
Shell Mini-Lab (UNIX)


   Get into the UNIX shell provided for the class
     – Type "/bin/sh". Which shell is running now?
     – Type "pwd". What is the current directory?
     – Type "echo $PATH". What is the meaning of the output?
     – Create a script named "ls":
         echo "echo gotcha" > ls
     – Allow execution by running "chmod a+rx ls"
     – Compare the execution of "ls" and "./ls". Why is the
       output different?
     – Type "PATH=.:/bin:/sbin:/usr/bin:/usr/sbin".
       What is the effect when you run “ls”?
Shell Mini-Lab (UNIX continued)


     Compare the execution of "ls" with "/bin/ls".
     What kind of path is "/bin/ls"?
     Type "cd /bin"
     Compare the results of running "ls" and "./ls".
Question


   A "relative path" is relative to:
    a) Your home directory
    b) The current working directory
    c) The root (top) directory (e.g. “C:” or “/”)
Question


   A "relative path" is relative to:
    a) Your home directory
    b) The current working directory
    c) The root (top) directory (e.g. “C:” or “/”)
Question


   Why is the PATH environment variable important?
    a) It specifies the order of directories in which a
    shell looks for a file, when a relative path has been
    specified
    b) It changes the execution path within applications
    c) You must follow your own path
Question


   Why is the PATHEXT environment variable
    important?
Question


   In a UNIX shell, when an application runs
    "./filename", which file is run?
    a) The file of the same name ("filename") in the
    same directory as the application
    b) The file of the same name ("filename") in the
    current working directory of the application
    c) The file of the same name ("filename") in a
    directory specified by the PATH environment
    variable
Question


   In a Windows shell, when an application runs
    "filename", which file is run? Choose the best
    answer.
    a) The file of the same name ("filename") in a
    directory specified by the PATH environment variable
    b) The file of the same name ("filename") in the
    current working directory of the application
    c) The first file in the current directory that matches
    the first extension in the PATHEXT environment
    variable
    d) The file of the same name ("filename") in the same
    directory as the application
Question


   Which is more secure to run?
    a) ./filename or .filename
    b) filename
    c) /bin/filename or
    c:WINNTsystem32filename.exe
Question


   Which is more secure to run?
    a) ./filename or .filename
    b) filename
    c) /bin/filename or
    c:WINNTsystem32filename.exe

  • Comment: Because ./filename refers to the current
    path, it has a level of indirection that can be
    exploited.
    • Always specify absolute paths unless impossible.
    • Explicitly set the PATH and any other important
       environment variables.
Substitutions: Outline


     What are substitutions?
     Vulnerability due to substitutions
     How not to patch
     White list best practice
     Mini-Lab 2: A shell exploit
What can be substituted?


     Filename substitutions (wildcards, a.k.a. globbing)
     Directory stack substitution
     Command substitution
     Subshells
     Other substitutions

   UNIX Example: ls /var/*/*log*
      –   /var/log/boot.log
      –   /var/log/prelink.log
      –   /var/log/Xorg.0.log
      –   /var/run/klogd.pid
      –   /var/run/syslogd.pid
GNU ‘bash’ prompt parsing vulnerability
CVE-1999-0491, BID 119

   UNIX back-tick (command substitution)
     – Typing "`command`" on the command line executes the
       command, even if it should have been an argument for
       another command
   Mallory runs: mkdir "`command`"
     – Create directory with a command inside back-ticks
   Alice runs: cd "`command`"
   Mallory’s command executed by Alice
     – This could happen when moving around directories with
       symlinks
   Code injection due to full shell interpretation of
    directory name
Prompt parsing vulnerability
Fixed in tcsh 6.07

   Changelog:
    “33. Add VAR_NOGLOB, and use it to avoid
    globbing directory names when cd'ing into them.“
   Flag "VAR_NOGLOB" is used to identify situations
    where substitution (incorrectly implied to be
    globbing) should not be done
   Question: Did the programmer fix all of the
    situations where substitution shouldn’t be done?
Prompt parsing vulnerability
tcsh 6.07 Code Fix

     /* set: storage into hashed/balanced tree */
      void
      set1(var, vec, head, flags)
           Char   *var, **vec;
           struct varent *head;
           int flags;
      {
           register Char **oldv = vec;

         if ((flags & VAR_NOGLOB) == 0) {
           /* if not forbidden, do the globbing */
            gflag = 0;
            tglob(oldv);
      ...

      Note: double negation -- avoid if you can
      *** keep code simple if you can ***
Prompt parsing vulnerability
tcsh 6.07 Code Fix: "Diff" output

   diff tcsh-6.06/sh.dir.c tcsh-6.07.02/sh.dir.c

    < set(STRdirstack, Strsave(dp->di_name), VAR_READWRITE);
    ---
    > set(STRdirstack, Strsave(dp->di_name), VAR_READWRITE |
    VAR_NOGLOB);


    < set(STRowd, Strsave(varval(STRcwd)), VAR_READWRITE);
    < set(STRcwd, Strsave(dp), VAR_READWRITE);
    ---
    > set(STRowd, Strsave(varval(STRcwd)), VAR_READWRITE |
    VAR_NOGLOB);
    > set(STRcwd, Strsave(dp), VAR_READWRITE | VAR_NOGLOB);
Prompt parsing vulnerability
Discussion: What's Wrong?

   The fix forbids substitution (including globbing) only
    when dealing with changing directories.




   Why is this is a brittle fix and a bad practice?
Prompt parsing vulnerability
Discussion: Sample Answer

   The first fix forbids substitutions when printing the
    prompt ('w' option)
   The second fix forbids substitution when changing
    directories
   The nth fix forbids substitution for yet another
    situation.
White List Best Practice


   Mechanism should not require enumeration of
    each dangerous thing (black list)
     – It’s easy to miss things
   Instead, mechanism should be designed to deny all
    by default unless something is explicitly
    enumerated as safe (white list)
   Outline of incorrect fix approach:
     – Try to block or forbid a specific exploitation path
     – Result: another path is found
          Underlying problem still exists
          Common repeated mistake
          Multiple patching attempts are costly and annoy customers
Mini-Lab 2: UNIX
An exploit to gain shell access

   Most exploits are aimed at giving an attacker shell
    access
     – "Execute arbitrary code" usually means starting a shell
   Next, a back door is installed.
   Warning: your account could get compromised by
    doing this mini-lab
     – don't perform the "chmod" operations (comment them out)
          instructor will demo some student solutions in a throw-away
           account
     – *or* don't use a university account
   In this lab, you will create a back door with a setuid
    "C" program
     – setuid scripts are now disabled by default in many OSes
Mini-Lab 2: UNIX
A Back Door

   Create a C program containing:
      –   setreuid(geteuid(), geteuid())
      –   execlp("/bin/sh", "/bin/sh", 0)


   Do chmod 4755 your_program (makes it setuid)
   This is a backdoor into your account!
   Team up with someone else
   With their permission, execute the back door they
    have written
   Type "whoami" or “id” into the shell you get
Mini-Lab 2: UNIX
A Back-Door Creating Script

   Inside a directory where only you have execute
    privileges, write a shell script that will
     – Write the C program you wrote into a file
     – Compile it
     – Use chmod to set the setuid bit and allow anyone to run it.
   What will happen if another user runs the shell
    script?
   How can you persuade another user to run it?
   Turn in the shell script (email it to me)
   Make sure to delete the C program from your
    account...
Mini-Lab 2: UNIX
Answers

   What will happen if someone runs it?
     – It will create a backdoor script into their account
   How can you get someone to run it?
     – Create a directory named `bcs`
          if using a vulnerable version of bash or tcsh
     – Send it to them as an email attachment
     – Make it do something useful or interesting, and put it in a
       shared area; wait for someone to run your trojan program.
     – Name it the same as a common system command an wait
       for someone who has "." in their path to run it by accident
       from a directory where you have write access.
     – Exploit a vulnerability into a program running as root or
       LocalSystem
Discussion Question


   How can you configure Windows services to
    mitigate the consequences of a vulnerability?
   Hint: Apply the principle of least privilege
Discussion Sample Answers


   Windows: Services that run as System
     – Change the account associated with a service ("Log On
       As" setting), from LocalSystem to a lower privilege
       account (you need to configure that account carefully, or
       use LocalService or NetworkService)
   Sometimes, users can't figure out why their
    software doesn't work so they make it run with an
    administrator account, which is even worse!
     – Principle of psychological acceptability: "This is too hard,
       so let's open it and grant it all privileges so it works!"
   UNIX: This is mitigated by configuring services to
    run as "nobody" or separate accounts with limited
    privileges for each service
Question


   Why is a secure configuration difficult to achieve?
    a) Operating systems are complex
    b) Users will break security (if they can) to get their
    services to run
    c) There are many services to secure
    d) All of the above
Question


   Why is a secure configuration difficult to achieve?
    a) Operating systems are complex
    b) Users will break security (if they can) to get their
    services to run
    c) There are many services to secure
    d) All of the above

   Installing things secure by default is becoming
    more popular and expected
Discussion Question


   What can you do to improve the security of your
    projects when you go back to work at the end of
    this tutorial?
Environment: Outline


   What is the environment?
   Can you trust the environment?
   Environment pollution attacks
What is the environment?


   File System
     – Correct permissions/ACLs on files
     – Partitions
   Operating System, sandboxes
   Services
   Accounts
     – Correct account permissions
   Environment variables
     – e.g., PATH
   Other defaults
     – e.g., umask (for new file default permissions)
   Logging facilities
Trusting the Environment?


   As the developer of an application, you (should)
    know how to secure the environment
   Configure files with the correct permissions during
    installation
   Umask: Create files with correct permissions
   Environment variables are typically under the
    control of untrusted users
Question


   Who controls the value of the PATH variable?
    What does that tell you about other environment
    variables? (Hint: A search for "environment" in
    ICAT gave 192 entries in spring 2004; the NVD
    now lists 310 entries as of January 17, 2006)
Environment Pollution


   A program can get values from the environment
   Some variables are used automatically
     – Win32 process hooking, dll injection, Microsoft research
       detours library
     – UNIX LD_LIBRARY_PATH, LD_PRELOAD
          Function interception (library interposition)
          Before you get control!
   An attacker can influence environment:
     –   For code injection attacks
     –   To create buffer overflows
     –   To bypass access controls
     –   Denial of service (crashes for various reasons)
Comments on PHP Poisoning


  PHP was designed for power and ease-of-use in
   CGI programming, not security
  CGI parameters automatically become variables
   within PHP scripts
    – Attacker can control logical flow of program
    – Option turned off by default in new versions of PHP
        Used to be ON by default
Example PHP Poisoning


   PHP: Variables inside the program can be
    initialized with values supplied by the remote client
    (register_globals option)!
   <php
    if ($username == $allowed && $password
    == $secret) $authorized = “yes”;
    ...
    if ($authorized == “yes”) {
    ...
    }
    ?>
   “url?authorized=yes” bypasses authentication
Configuration: Outline


   Default accounts
   Hard-coded passwords and backdoors
   Unsafe configuration interfaces
Configuration Best Practice


   All dangerous configuration options should be
    turned off by default (SD3 – secure by design,
    secure by default, secure in deployment)
   The developer should know what options are
    dangerous
   Customer doesn't know any better so the
    installation and configuration program should
    provide guarantees
     – Exceptions should provide warnings
Question


   Are accounts with default passwords a good
    secure configuration practice?
    a) It doesn't matter, they are necessary
    b) Yes, if they are kept secret
    c) No

   Hint: see
      http://www.cirt.net/cgi-bin/passwd.pl
      http://www.phenoelit.de/dpl/dpl.html
Discussion


   What can your software do instead of using
    accounts with default passwords?
Discussion Sample Answers


   What can your software do instead of using
    accounts with default passwords?

     – Functionality could be blocked until accounts are set
       properly (with appropriate notices so customer doesn't
       think that the program or equipment is broken)

     – If the default account can't be avoided, most functionality
       could be disabled until the default account is removed by
       the administrator.
Hard-Coded Passwords


  Open design security principle
  Hard-coded passwords are a failure in the
   application of that principle
    – revealed password may result in a catastrophic failure
  OEM requirements and ease-of-use may be at
   odds with this principle
Wireless Access Points, Hard Drives, etc...


   Does it sound reasonably safe to you to only allow
    configuration of these devices from a wireless PC,
    instead of requiring a wired connection?
     – Cisco access points
         Serial connection available for less user friendly setup
     – Other brands
Logging


  Logging is an important, often requested security
   functional requirement
    – Especially if application has its own access control
  Logging integrity
    – Append-only loggers
    – External loggers
  Logging confidentiality issues (passwords)
    – Authority needed to view audit logs should be higher than
      the privilege to administer the product
Attacks on Logs


   Denial of service using chaff (junk; noise)
   Semantic attacks (fake log entries)
   Log entries with special characters
   Log entries attempting to exploit vulnerabilities in
    the logging mechanism
   Log entries attempting to exploit vulnerabilities in
    the log viewing mechanism
   Logging second-hand or uncertain information
      – Spoofed identities
   Write to syslog from any location on the network
Log Denial-of-Service Attacks


   CVE-1999-0566
    An attacker can write to syslog files from any
    location, causing a denial of service by filling up the
    logs, and hiding activities.
     – Chaff attack


   CVE-1999-0063
    Cisco IOS 12.0 and other versions can be crashed
    by malicious UDP packets to the syslog port.

   Solutions: Access control lists, firewall rules, etc...
Example Logging Issues


   CVE-2003-0020
    Apache does not filter terminal escape sequences
    from its error logs, which could make it easier for
    attackers to insert those sequences into terminal
    emulators containing vulnerabilities related to
    escape sequences.

   CVE-2003-0460
    The rotatelogs program on Apache before 1.3.28,
    for Windows and OS/2 systems, does not properly
    ignore certain control characters that are received
    over the pipe, which could allow remote attackers
    to cause a denial of service.
More Example Logging Issues


   CVE-2001-1098
    Cisco PIX firewall manager (PFM) 4.3(2)g records
    the enable password in plaintext to the pfm.log
    file, which could allow local users to obtain the
    password by reading the file.

   CVE-2002-0113
    Legato NetWorker 6.1 stores log files in the
    /nsr/logs/ directory with world-readable
    permissions, which allows local users to read
    sensitive information and potentially gain privileges.
Yet More Example Logging Issues


   CVE-2001-1403
    Bugzilla versions prior to 2.14 – username and
    password from URLs recorded in logs
   CVE-2001-0300
    oidldapd 2.1.1.1 in Oracle 8.1.7 - local users can
    delete logs and/or overwrite other files via a
    symlink attack.
   CVE-2001-0870
    HTTP server in Alchemy Eye and Alchemy
    Network Monitor 1.9x through 2.6.18
   CVE-2001-0908
    CITRIX Metaframe 1.8
Logging Mistakes!


  CVE-2000-1179
   Netopia ISDN Router 650-ST allowed unauthenticated
   remote attackers to read system logs using certain
   control characters.
  CVE-2000-0967
   PHP 3 and 4 did not properly cleanse user-injected
   format strings, allowing remote attackers to execute
   arbitrary commands by triggering error messages that
   were improperly written to the error logs.
  CVE-2000-0642
   The default configuration of WebActive HTTP Server
   1.00 stores the web log active.log in the web
   server’s root document directory.
Question


   Logging can be attacked by:
    a) Exclusively using exploits that require an
    account on the local machine
    b) Using maliciously constructed data
    c) Exclusively using exploits that break an
    application that sends log data to the logging
    mechanism
Question


   Logging can be attacked by:
    a) Exclusively using exploits that require an
    account on the local machine
    b) Using maliciously constructed data
    c) Exclusively using exploits that break an
    application that sends log data to the logging
    mechanism
Logging Defenses


   Use different logs for:
     – Events
         For users to see why their page/project/etc... failed
         Per user log even better
     – Operations
         Allow normal administrative supervision
         e.g., "started at 9:32 PM"
         e.g., "error reading configuration file at ..."
     – Audit
         For sensitive information
         e.g., Failed logins
            –   Usernames
            –   Passwords entered in username field
                 » Both matched pairs usually available in audit log
Calling External Programs


   Wrappers
   Calling paradigms
     – Shell
     – Special calls
         Custom environment
   File descriptors
The Wrapper Problem


   Calls to an insecure application can be wrapped
    inside and protected by another program that
    performs input validation and access control
   Wrapper must have an exact and complete model
    of the grammar and semantics used by the
    protected application, otherwise:
     – Insecure application loses functionality
     – Wrapper lets through dangerous (“unexpected”)
       commands
   Updates to an insecure application require an
    updated wrapper
Example Wrapper Problem


   wu-ftpd CVE-1999-0997
     – FTP server
   wu-ftp with FTP conversion enabled allows an
    attacker to execute commands via a malformed file
    name that is interpreted as an argument to the
    program that does the conversion, e.g. tar or
    uncompress.
     – Conversion is used to compress or uncompress files
     – File names passed to tar without checking if one really is
       a command line option that can be abused!
          e.g., --use-compress-program <program>
          e.g., --remove-files
Wrapper Through Interpreted Code


   When application is invoked by a command
    processed through a complex interpreter
   Examples:
     – calling programs through the system() and wsystem()
       calls (UNIX and Windows)
     – other cases of dynamic code generation (SQL, etc...)
   Modeling the interpreter is difficult.
     – “exec” family of UNIX calls presents a simplified interface
       that limits misinterpretations and engineered attacks.
     – Windows "CreateProcess*", "ShellExecute", "WinExec"
       have complex cases that allow engineered attacks
Windows Call Complexity


   CreateProcess (
       lpApplicationName,
       lpCommandLine,
    ...)
   If lpApplicationName is NULL, then
    lpCommandLine is interpreted...
     – Looks for an application name
         White space separators
         White space in directory names are "tried" as separators
            –   C:Program FilesApplicationDirAppname.exe
            –   C:Program.exe would get executed if present
            –   Solution: enclose application in quotes, but why not specify
                lpApplicationName then?

                         (From Howard and Leblanc, 2003)
UNIX “system " Call


   Program and arguments are interpreted by a shell!
     – very difficult to model and sanitize
   Also available on Windows!
   Exec calls
     – exect and execle allow the separation of path,
       arguments, and environment
          Fewer risks
     – int exect(const char *path, char *const argv[], char *const
       envp[]);
Question


   execlp and execvp search the PATH like a shell
    does if the specified path is not absolute. Are they:
    a) As safe as execv
    b) Less safe than execv
    c) More safe than execv

   int execv(const char *path, char *const argv[]);
   int execvp(const char *file, char *const argv[]);
Question


   Rank the following calls in order of safety (high to
    low):
     –   system
     –   execle
     –   execv
     –   execvp


    a) execv, execvp, execle, system
    b) execle, execv, execvp, system
    c) execvp, execle, execv, system
Question


     Rank the following calls in order of safety (high to
      low):
      –   system
      –   execle
      –   execv
      –   execvp


  a) execv, execvp, execle, system
  b) execle, execv, execvp, system
  c) execvp, execle, execv, system
File Descriptors


   UNIX: forked and exec’ed processes inherit file
    descriptors
   Remember the principle of complete mediation
   Close all unneeded file descriptors (before calling
    exec)
Questions?
About These Slides


     You are free to copy, distribute, display, and perform the work; and
      to make derivative works, under the following conditions.
      –   You must give the original author and other contributors credit
      –   The work will be used for personal or non-commercial educational uses
          only, and not for commercial activities and purposes
      –   For any reuse or distribution, you must make clear to others the terms of
          use for this work
      –   Derivative works must retain and be subject to the same conditions, and
          contain a note identifying the new contributor(s) and date of modification
      –   For other uses please contact the Purdue Office of Technology
          Commercialization.

   Developed thanks to the support of Symantec
    Corporation
Pascal Meunier
pmeunier@purdue.edu
Contributors:
Jared Robinson, Alan Krassowski, Craig Ozancin, Tim
Brown, Wes Higaki, Melissa Dark, Chris Clifton, Gustavo
Rodriguez-Rivera

More Related Content

What's hot

Course 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesCourse 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment Variables
Ahmed El-Arabawy
 
Spsl by sasidhar 3 unit
Spsl by sasidhar  3 unitSpsl by sasidhar  3 unit
Spsl by sasidhar 3 unit
Sasidhar Kothuru
 
intro unix/linux 10
intro unix/linux 10intro unix/linux 10
intro unix/linux 10
duquoi
 
4.6 create and change hard and symbolic links v2
4.6 create and change hard and symbolic links v24.6 create and change hard and symbolic links v2
4.6 create and change hard and symbolic links v2
Acácio Oliveira
 
Quick guide of the most common linux commands
Quick guide of the most common linux commandsQuick guide of the most common linux commands
Quick guide of the most common linux commands
Carlos Enrique
 
Unit 3
Unit  3Unit  3
Unit 3siddr
 
Unix_commands_theory
Unix_commands_theoryUnix_commands_theory
Unix_commands_theoryNiti Patel
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring
Ahmed El-Arabawy
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Ahmed El-Arabawy
 
intro unix/linux 09
intro unix/linux 09intro unix/linux 09
intro unix/linux 09
duquoi
 
intro unix/linux 07
intro unix/linux 07intro unix/linux 07
intro unix/linux 07
duquoi
 
intro unix/linux 11
intro unix/linux 11intro unix/linux 11
intro unix/linux 11
duquoi
 
Part 6 of "Introduction to linux for bioinformatics": Productivity tips
Part 6 of "Introduction to linux for bioinformatics": Productivity tipsPart 6 of "Introduction to linux for bioinformatics": Productivity tips
Part 6 of "Introduction to linux for bioinformatics": Productivity tips
Joachim Jacob
 
Spsl unit1
Spsl   unit1Spsl   unit1
Spsl unit1
Sasidhar Kothuru
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in Linux
Anu Chaudhry
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
sudhir singh yadav
 
Easiest way to start with Shell scripting
Easiest way to start with Shell scriptingEasiest way to start with Shell scripting
Easiest way to start with Shell scripting
Akshay Siwal
 
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentationMacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
OlehLevytskyi1
 

What's hot (20)

Course 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesCourse 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment Variables
 
Spsl by sasidhar 3 unit
Spsl by sasidhar  3 unitSpsl by sasidhar  3 unit
Spsl by sasidhar 3 unit
 
intro unix/linux 10
intro unix/linux 10intro unix/linux 10
intro unix/linux 10
 
4.6 create and change hard and symbolic links v2
4.6 create and change hard and symbolic links v24.6 create and change hard and symbolic links v2
4.6 create and change hard and symbolic links v2
 
Quick guide of the most common linux commands
Quick guide of the most common linux commandsQuick guide of the most common linux commands
Quick guide of the most common linux commands
 
Unit 3
Unit  3Unit  3
Unit 3
 
Unix_commands_theory
Unix_commands_theoryUnix_commands_theory
Unix_commands_theory
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
 
intro unix/linux 09
intro unix/linux 09intro unix/linux 09
intro unix/linux 09
 
intro unix/linux 07
intro unix/linux 07intro unix/linux 07
intro unix/linux 07
 
intro unix/linux 11
intro unix/linux 11intro unix/linux 11
intro unix/linux 11
 
Part 6 of "Introduction to linux for bioinformatics": Productivity tips
Part 6 of "Introduction to linux for bioinformatics": Productivity tipsPart 6 of "Introduction to linux for bioinformatics": Productivity tips
Part 6 of "Introduction to linux for bioinformatics": Productivity tips
 
21bUc8YeDzZpE
21bUc8YeDzZpE21bUc8YeDzZpE
21bUc8YeDzZpE
 
Spsl unit1
Spsl   unit1Spsl   unit1
Spsl unit1
 
Shell Scripting in Linux
Shell Scripting in LinuxShell Scripting in Linux
Shell Scripting in Linux
 
Os Cook
Os CookOs Cook
Os Cook
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Easiest way to start with Shell scripting
Easiest way to start with Shell scriptingEasiest way to start with Shell scripting
Easiest way to start with Shell scripting
 
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentationMacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
 

Viewers also liked

Session 8 Tp8
Session 8 Tp8Session 8 Tp8
Session 8 Tp8phanleson
 
5.Dns Rpc Nfs
5.Dns Rpc Nfs5.Dns Rpc Nfs
5.Dns Rpc Nfsphanleson
 
302 Content Server Security Challenges And Best Practices
302   Content Server Security   Challenges And Best Practices302   Content Server Security   Challenges And Best Practices
302 Content Server Security Challenges And Best Practicesphanleson
 
Session 6 Tp6
Session 6 Tp6Session 6 Tp6
Session 6 Tp6phanleson
 
6.Resource Exhaustion
6.Resource Exhaustion6.Resource Exhaustion
6.Resource Exhaustionphanleson
 
6.Temp & Rand
6.Temp & Rand6.Temp & Rand
6.Temp & Randphanleson
 

Viewers also liked (8)

Call Back
Call BackCall Back
Call Back
 
Session 8 Tp8
Session 8 Tp8Session 8 Tp8
Session 8 Tp8
 
5.Dns Rpc Nfs
5.Dns Rpc Nfs5.Dns Rpc Nfs
5.Dns Rpc Nfs
 
302 Content Server Security Challenges And Best Practices
302   Content Server Security   Challenges And Best Practices302   Content Server Security   Challenges And Best Practices
302 Content Server Security Challenges And Best Practices
 
Session 6 Tp6
Session 6 Tp6Session 6 Tp6
Session 6 Tp6
 
6.Resource Exhaustion
6.Resource Exhaustion6.Resource Exhaustion
6.Resource Exhaustion
 
6.Temp & Rand
6.Temp & Rand6.Temp & Rand
6.Temp & Rand
 
4.Xss
4.Xss4.Xss
4.Xss
 

Similar to 5.Shell And Environment

Linux admin interview questions
Linux admin interview questionsLinux admin interview questions
Linux admin interview questionsKavya Sri
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools
Vu Hung Nguyen
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338Cam YP Co., Ltd
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
Cam YP Co., Ltd
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
anandvaidya
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
Manav Prasad
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
QIANG XU
 
1 of 9 CSCE 3600 Systems Programming Major Assignm.docx
  1 of 9 CSCE 3600 Systems Programming  Major Assignm.docx  1 of 9 CSCE 3600 Systems Programming  Major Assignm.docx
1 of 9 CSCE 3600 Systems Programming Major Assignm.docx
ShiraPrater50
 
Operating system (remuel)
Operating system (remuel)Operating system (remuel)
Operating system (remuel)
Remuel Malinao
 
Linux Notes-1.pdf
Linux Notes-1.pdfLinux Notes-1.pdf
Linux Notes-1.pdf
asif64436
 
Using Unix
Using UnixUsing Unix
Using UnixDr.Ravi
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
Gourav Varma
 
Systemcall1
Systemcall1Systemcall1
Systemcall1
pavimalpani
 
dotCloud (now Docker) Paas under the_hood
dotCloud (now Docker) Paas under the_hood dotCloud (now Docker) Paas under the_hood
dotCloud (now Docker) Paas under the_hood Susan Wu
 
intro unix/linux 02
intro unix/linux 02intro unix/linux 02
intro unix/linux 02
duquoi
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
vtunotesbysree
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS
 
Managing ADLS gen2 using Apache Spark
Managing ADLS gen2 using Apache SparkManaging ADLS gen2 using Apache Spark
Managing ADLS gen2 using Apache Spark
Databricks
 

Similar to 5.Shell And Environment (20)

Linux admin interview questions
Linux admin interview questionsLinux admin interview questions
Linux admin interview questions
 
Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools Nguyễn Vũ Hưng: Basic Linux Power Tools
Nguyễn Vũ Hưng: Basic Linux Power Tools
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
 
Linux introduction-commands2338
Linux introduction-commands2338Linux introduction-commands2338
Linux introduction-commands2338
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Introduction to linux
Introduction to linuxIntroduction to linux
Introduction to linux
 
1 of 9 CSCE 3600 Systems Programming Major Assignm.docx
  1 of 9 CSCE 3600 Systems Programming  Major Assignm.docx  1 of 9 CSCE 3600 Systems Programming  Major Assignm.docx
1 of 9 CSCE 3600 Systems Programming Major Assignm.docx
 
Operating system (remuel)
Operating system (remuel)Operating system (remuel)
Operating system (remuel)
 
Linux Notes-1.pdf
Linux Notes-1.pdfLinux Notes-1.pdf
Linux Notes-1.pdf
 
Unix quicksheet
Unix quicksheetUnix quicksheet
Unix quicksheet
 
Using Unix
Using UnixUsing Unix
Using Unix
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
 
Systemcall1
Systemcall1Systemcall1
Systemcall1
 
dotCloud (now Docker) Paas under the_hood
dotCloud (now Docker) Paas under the_hood dotCloud (now Docker) Paas under the_hood
dotCloud (now Docker) Paas under the_hood
 
intro unix/linux 02
intro unix/linux 02intro unix/linux 02
intro unix/linux 02
 
3. intro
3. intro3. intro
3. intro
 
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERSVTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
VTU 3RD SEM UNIX AND SHELL PROGRAMMING SOLVED PAPERS
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
 
Managing ADLS gen2 using Apache Spark
Managing ADLS gen2 using Apache SparkManaging ADLS gen2 using Apache Spark
Managing ADLS gen2 using Apache Spark
 

More from phanleson

Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
phanleson
 
Firewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth FirewallsFirewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth Firewalls
phanleson
 
Mobile Security - Wireless hacking
Mobile Security - Wireless hackingMobile Security - Wireless hacking
Mobile Security - Wireless hacking
phanleson
 
Authentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless ProtocolsAuthentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless Protocols
phanleson
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
phanleson
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applications
phanleson
 
HBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table designHBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table design
phanleson
 
HBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - OperationsHBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - Operations
phanleson
 
Hbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBaseHbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBase
phanleson
 
Learning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlibLearning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlib
phanleson
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streaming
phanleson
 
Learning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLLearning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQL
phanleson
 
Learning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a ClusterLearning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a Cluster
phanleson
 
Learning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark ProgrammingLearning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark Programming
phanleson
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Data
phanleson
 
Learning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value PairsLearning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value Pairs
phanleson
 
Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
phanleson
 
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about LibertagiaHướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
phanleson
 
Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLphanleson
 
Lecture 4 - Adding XTHML for the Web
Lecture  4 - Adding XTHML for the WebLecture  4 - Adding XTHML for the Web
Lecture 4 - Adding XTHML for the Web
phanleson
 

More from phanleson (20)

Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Firewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth FirewallsFirewall - Network Defense in Depth Firewalls
Firewall - Network Defense in Depth Firewalls
 
Mobile Security - Wireless hacking
Mobile Security - Wireless hackingMobile Security - Wireless hacking
Mobile Security - Wireless hacking
 
Authentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless ProtocolsAuthentication in wireless - Security in Wireless Protocols
Authentication in wireless - Security in Wireless Protocols
 
E-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server AttacksE-Commerce Security - Application attacks - Server Attacks
E-Commerce Security - Application attacks - Server Attacks
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applications
 
HBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table designHBase In Action - Chapter 04: HBase table design
HBase In Action - Chapter 04: HBase table design
 
HBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - OperationsHBase In Action - Chapter 10 - Operations
HBase In Action - Chapter 10 - Operations
 
Hbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBaseHbase in action - Chapter 09: Deploying HBase
Hbase in action - Chapter 09: Deploying HBase
 
Learning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlibLearning spark ch11 - Machine Learning with MLlib
Learning spark ch11 - Machine Learning with MLlib
 
Learning spark ch10 - Spark Streaming
Learning spark ch10 - Spark StreamingLearning spark ch10 - Spark Streaming
Learning spark ch10 - Spark Streaming
 
Learning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLLearning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQL
 
Learning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a ClusterLearning spark ch07 - Running on a Cluster
Learning spark ch07 - Running on a Cluster
 
Learning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark ProgrammingLearning spark ch06 - Advanced Spark Programming
Learning spark ch06 - Advanced Spark Programming
 
Learning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your DataLearning spark ch05 - Loading and Saving Your Data
Learning spark ch05 - Loading and Saving Your Data
 
Learning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value PairsLearning spark ch04 - Working with Key/Value Pairs
Learning spark ch04 - Working with Key/Value Pairs
 
Learning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with SparkLearning spark ch01 - Introduction to Data Analysis with Spark
Learning spark ch01 - Introduction to Data Analysis with Spark
 
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about LibertagiaHướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
Hướng Dẫn Đăng Ký LibertaGia - A guide and introduciton about Libertagia
 
Lecture 1 - Getting to know XML
Lecture 1 - Getting to know XMLLecture 1 - Getting to know XML
Lecture 1 - Getting to know XML
 
Lecture 4 - Adding XTHML for the Web
Lecture  4 - Adding XTHML for the WebLecture  4 - Adding XTHML for the Web
Lecture 4 - Adding XTHML for the Web
 

Recently uploaded

Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 

Recently uploaded (20)

Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 

5.Shell And Environment

  • 1. Course 1: Overview of Secure Programming, Section 5 Pascal Meunier, Ph.D., M.Sc., CISSP May 2004; updated January 12, 2006 Developed thanks to support and contributions from Symantec Corporation, support from the NSF SFS Capacity Building Program (Award Number 0113725) and the Purdue e-Enterprise Center Copyright (2004) Purdue Research Foundation. All rights reserved.
  • 2. Course 1 Learning Plan  Security overview and patching  Public vulnerability databases and resources  Secure software engineering  Security assessment and testing  Shell and environment  Resource management  Trust management
  • 3. Learning objectives  Understand how shells interpret commands, launch and provide environments for processes – Understand how setuid or LocalSystem scripts and programs are risky  Understand how environments affect the security of applications  Understand how configuration issues affect the security of applications  Understand security issues in audit logs  Understand security issues in launching processes
  • 4. Operations Management and Best Practices  Shells  Environment  Configuration  Logging  Calling External Programs
  • 5. Shells: Outline  What is a shell?  Relative path vulnerabilities and mini-lab  Substitutions  Setuid scripts and programs
  • 6. What is a shell?  Launches programs, including other shells  Provides – Capabilities to applications – A user interface  Windows Explorer shell  Replacement Windows shells – Geoshell – Aston, etc... – Norton Desktop for Windows  UNIX shells – bash – tcsh, etc...
  • 7. Capabilities provided by Windows shells  Custom url handlers – Clicking on a url "outlook://" starts outlook – Buffer overflow when handling custom urls of improperly removed applications (CVE-2002-0070; MS02-014)  UI preferences – Buffer overflow when handling desktop.ini (CVE-2003- 0306; MS03-27)  Path resolution and handling – Relative shell path vulnerability in Windows 2000 and NT (CVE-2000-0663)  Run Explorer.exe trojan from another user  Various means of launching other programs – Buffer overflows (CVE-2002-1327, CVE-2003-0503)
  • 8. Capabilities of UNIX shells  Substitutions – Filename substitution (wildcard expansion, a.k.a. globbing) – Command substitution  bash and tcsh interpret backticks in names (CVE-1999- 1383)  Arbitrary command execution in GhostView handling of file names (CVE-2002-1569) (BID 5840)  Several other applications invoke shell capabilities!  Environment variables – PATH search variable  File system path resolution  Launching applications
  • 9. Relative Path Vulnerabilities  Relative paths trigger a search for the actual file. Is it: – In the current directory? – In some other directory specified by the PATH environment variable? – Which one of the above two should be done first?  Insecure default in Windows (see next slide)  ICAT: 15 entries (Windows, UNIX, others)  Common misconfiguration of UNIX accounts  Mini-Lab
  • 10. Windows PATH  Different behavior depending on version of Windows – Old behavior: current directory was searched first for DLLs – New behavior: search all system locations first  XP SP1  Windows 2003 – More secure, but...  The current directory is searched even if "." is not in your PATH, and searched before your PATH! – Insecure default – You may not get the DLL (dynamically loaded library) you wanted! (see Howard and Leblanc 2003)
  • 11. Windows Filename Extensions  What if you didn't specify the extension?  The environment variable PATHEXT decides the order (.com, .exe, .bat, .cmd, ...)  What if PATHEXT is changed by a malicious user, so a trojan would run instead?  Other ambiguities – Trailing dot, slash in filename – Long vs short name – Canonicalization issues covered in course 2, part 7 "Canonicalization and Directory Traversal"  Solution: Use the absolute path and complete name
  • 12. Shell Mini-Lab (Windows)  Open a command prompt – Type “command” within the window you opened. Which shell is running now? Now type “exit” – Type “cd“ or “set %CD%”. What is the current directory? – Type “set PATH". What is the meaning of the output? – Create a cmd file named “cmd.cmd":  echo @echo gotcha > cmd.cmd – Compare the execution of “cmd" and ".cmd". What is the difference, if any? – Type "set PATH=%PATH%;.". What effect does it have when you run “cmd”? – Create a batch file named “cmd.bat”:  echo @echo hello > cmd.bat
  • 13. Shell Mini-Lab (Windows continued)  What happens when you run “cmd” now? – How can you change the behavior?  Compare the results of running “cmd” with the results of running “%SYSTEMROOT%system32cmd”.  What kind of path is “%SYSTEMROOT%system32cmd”?  Type “%SYSTEMDRIVE%”  Type “cd %SYSTEMROOT%system32”  Compare the results of running “cmd” and “.cmd”.
  • 14. Shell Mini-Lab (UNIX)  Get into the UNIX shell provided for the class – Type "/bin/sh". Which shell is running now? – Type "pwd". What is the current directory? – Type "echo $PATH". What is the meaning of the output? – Create a script named "ls":  echo "echo gotcha" > ls – Allow execution by running "chmod a+rx ls" – Compare the execution of "ls" and "./ls". Why is the output different? – Type "PATH=.:/bin:/sbin:/usr/bin:/usr/sbin". What is the effect when you run “ls”?
  • 15. Shell Mini-Lab (UNIX continued)  Compare the execution of "ls" with "/bin/ls".  What kind of path is "/bin/ls"?  Type "cd /bin"  Compare the results of running "ls" and "./ls".
  • 16. Question  A "relative path" is relative to: a) Your home directory b) The current working directory c) The root (top) directory (e.g. “C:” or “/”)
  • 17. Question  A "relative path" is relative to: a) Your home directory b) The current working directory c) The root (top) directory (e.g. “C:” or “/”)
  • 18. Question  Why is the PATH environment variable important? a) It specifies the order of directories in which a shell looks for a file, when a relative path has been specified b) It changes the execution path within applications c) You must follow your own path
  • 19. Question  Why is the PATHEXT environment variable important?
  • 20. Question  In a UNIX shell, when an application runs "./filename", which file is run? a) The file of the same name ("filename") in the same directory as the application b) The file of the same name ("filename") in the current working directory of the application c) The file of the same name ("filename") in a directory specified by the PATH environment variable
  • 21. Question  In a Windows shell, when an application runs "filename", which file is run? Choose the best answer. a) The file of the same name ("filename") in a directory specified by the PATH environment variable b) The file of the same name ("filename") in the current working directory of the application c) The first file in the current directory that matches the first extension in the PATHEXT environment variable d) The file of the same name ("filename") in the same directory as the application
  • 22. Question  Which is more secure to run? a) ./filename or .filename b) filename c) /bin/filename or c:WINNTsystem32filename.exe
  • 23. Question  Which is more secure to run? a) ./filename or .filename b) filename c) /bin/filename or c:WINNTsystem32filename.exe • Comment: Because ./filename refers to the current path, it has a level of indirection that can be exploited. • Always specify absolute paths unless impossible. • Explicitly set the PATH and any other important environment variables.
  • 24. Substitutions: Outline  What are substitutions?  Vulnerability due to substitutions  How not to patch  White list best practice  Mini-Lab 2: A shell exploit
  • 25. What can be substituted?  Filename substitutions (wildcards, a.k.a. globbing)  Directory stack substitution  Command substitution  Subshells  Other substitutions  UNIX Example: ls /var/*/*log* – /var/log/boot.log – /var/log/prelink.log – /var/log/Xorg.0.log – /var/run/klogd.pid – /var/run/syslogd.pid
  • 26. GNU ‘bash’ prompt parsing vulnerability CVE-1999-0491, BID 119  UNIX back-tick (command substitution) – Typing "`command`" on the command line executes the command, even if it should have been an argument for another command  Mallory runs: mkdir "`command`" – Create directory with a command inside back-ticks  Alice runs: cd "`command`"  Mallory’s command executed by Alice – This could happen when moving around directories with symlinks  Code injection due to full shell interpretation of directory name
  • 27. Prompt parsing vulnerability Fixed in tcsh 6.07  Changelog: “33. Add VAR_NOGLOB, and use it to avoid globbing directory names when cd'ing into them.“  Flag "VAR_NOGLOB" is used to identify situations where substitution (incorrectly implied to be globbing) should not be done  Question: Did the programmer fix all of the situations where substitution shouldn’t be done?
  • 28. Prompt parsing vulnerability tcsh 6.07 Code Fix  /* set: storage into hashed/balanced tree */ void set1(var, vec, head, flags) Char *var, **vec; struct varent *head; int flags; { register Char **oldv = vec; if ((flags & VAR_NOGLOB) == 0) { /* if not forbidden, do the globbing */ gflag = 0; tglob(oldv); ... Note: double negation -- avoid if you can *** keep code simple if you can ***
  • 29. Prompt parsing vulnerability tcsh 6.07 Code Fix: "Diff" output  diff tcsh-6.06/sh.dir.c tcsh-6.07.02/sh.dir.c < set(STRdirstack, Strsave(dp->di_name), VAR_READWRITE); --- > set(STRdirstack, Strsave(dp->di_name), VAR_READWRITE | VAR_NOGLOB); < set(STRowd, Strsave(varval(STRcwd)), VAR_READWRITE); < set(STRcwd, Strsave(dp), VAR_READWRITE); --- > set(STRowd, Strsave(varval(STRcwd)), VAR_READWRITE | VAR_NOGLOB); > set(STRcwd, Strsave(dp), VAR_READWRITE | VAR_NOGLOB);
  • 30. Prompt parsing vulnerability Discussion: What's Wrong?  The fix forbids substitution (including globbing) only when dealing with changing directories.  Why is this is a brittle fix and a bad practice?
  • 31. Prompt parsing vulnerability Discussion: Sample Answer  The first fix forbids substitutions when printing the prompt ('w' option)  The second fix forbids substitution when changing directories  The nth fix forbids substitution for yet another situation.
  • 32. White List Best Practice  Mechanism should not require enumeration of each dangerous thing (black list) – It’s easy to miss things  Instead, mechanism should be designed to deny all by default unless something is explicitly enumerated as safe (white list)  Outline of incorrect fix approach: – Try to block or forbid a specific exploitation path – Result: another path is found  Underlying problem still exists  Common repeated mistake  Multiple patching attempts are costly and annoy customers
  • 33. Mini-Lab 2: UNIX An exploit to gain shell access  Most exploits are aimed at giving an attacker shell access – "Execute arbitrary code" usually means starting a shell  Next, a back door is installed.  Warning: your account could get compromised by doing this mini-lab – don't perform the "chmod" operations (comment them out)  instructor will demo some student solutions in a throw-away account – *or* don't use a university account  In this lab, you will create a back door with a setuid "C" program – setuid scripts are now disabled by default in many OSes
  • 34. Mini-Lab 2: UNIX A Back Door  Create a C program containing: – setreuid(geteuid(), geteuid()) – execlp("/bin/sh", "/bin/sh", 0)  Do chmod 4755 your_program (makes it setuid)  This is a backdoor into your account!  Team up with someone else  With their permission, execute the back door they have written  Type "whoami" or “id” into the shell you get
  • 35. Mini-Lab 2: UNIX A Back-Door Creating Script  Inside a directory where only you have execute privileges, write a shell script that will – Write the C program you wrote into a file – Compile it – Use chmod to set the setuid bit and allow anyone to run it.  What will happen if another user runs the shell script?  How can you persuade another user to run it?  Turn in the shell script (email it to me)  Make sure to delete the C program from your account...
  • 36. Mini-Lab 2: UNIX Answers  What will happen if someone runs it? – It will create a backdoor script into their account  How can you get someone to run it? – Create a directory named `bcs`  if using a vulnerable version of bash or tcsh – Send it to them as an email attachment – Make it do something useful or interesting, and put it in a shared area; wait for someone to run your trojan program. – Name it the same as a common system command an wait for someone who has "." in their path to run it by accident from a directory where you have write access. – Exploit a vulnerability into a program running as root or LocalSystem
  • 37. Discussion Question  How can you configure Windows services to mitigate the consequences of a vulnerability?  Hint: Apply the principle of least privilege
  • 38. Discussion Sample Answers  Windows: Services that run as System – Change the account associated with a service ("Log On As" setting), from LocalSystem to a lower privilege account (you need to configure that account carefully, or use LocalService or NetworkService)  Sometimes, users can't figure out why their software doesn't work so they make it run with an administrator account, which is even worse! – Principle of psychological acceptability: "This is too hard, so let's open it and grant it all privileges so it works!"  UNIX: This is mitigated by configuring services to run as "nobody" or separate accounts with limited privileges for each service
  • 39. Question  Why is a secure configuration difficult to achieve? a) Operating systems are complex b) Users will break security (if they can) to get their services to run c) There are many services to secure d) All of the above
  • 40. Question  Why is a secure configuration difficult to achieve? a) Operating systems are complex b) Users will break security (if they can) to get their services to run c) There are many services to secure d) All of the above  Installing things secure by default is becoming more popular and expected
  • 41. Discussion Question  What can you do to improve the security of your projects when you go back to work at the end of this tutorial?
  • 42. Environment: Outline  What is the environment?  Can you trust the environment?  Environment pollution attacks
  • 43. What is the environment?  File System – Correct permissions/ACLs on files – Partitions  Operating System, sandboxes  Services  Accounts – Correct account permissions  Environment variables – e.g., PATH  Other defaults – e.g., umask (for new file default permissions)  Logging facilities
  • 44. Trusting the Environment?  As the developer of an application, you (should) know how to secure the environment  Configure files with the correct permissions during installation  Umask: Create files with correct permissions  Environment variables are typically under the control of untrusted users
  • 45. Question  Who controls the value of the PATH variable? What does that tell you about other environment variables? (Hint: A search for "environment" in ICAT gave 192 entries in spring 2004; the NVD now lists 310 entries as of January 17, 2006)
  • 46. Environment Pollution  A program can get values from the environment  Some variables are used automatically – Win32 process hooking, dll injection, Microsoft research detours library – UNIX LD_LIBRARY_PATH, LD_PRELOAD  Function interception (library interposition)  Before you get control!  An attacker can influence environment: – For code injection attacks – To create buffer overflows – To bypass access controls – Denial of service (crashes for various reasons)
  • 47. Comments on PHP Poisoning  PHP was designed for power and ease-of-use in CGI programming, not security  CGI parameters automatically become variables within PHP scripts – Attacker can control logical flow of program – Option turned off by default in new versions of PHP  Used to be ON by default
  • 48. Example PHP Poisoning  PHP: Variables inside the program can be initialized with values supplied by the remote client (register_globals option)!  <php if ($username == $allowed && $password == $secret) $authorized = “yes”; ... if ($authorized == “yes”) { ... } ?>  “url?authorized=yes” bypasses authentication
  • 49. Configuration: Outline  Default accounts  Hard-coded passwords and backdoors  Unsafe configuration interfaces
  • 50. Configuration Best Practice  All dangerous configuration options should be turned off by default (SD3 – secure by design, secure by default, secure in deployment)  The developer should know what options are dangerous  Customer doesn't know any better so the installation and configuration program should provide guarantees – Exceptions should provide warnings
  • 51. Question  Are accounts with default passwords a good secure configuration practice? a) It doesn't matter, they are necessary b) Yes, if they are kept secret c) No  Hint: see  http://www.cirt.net/cgi-bin/passwd.pl  http://www.phenoelit.de/dpl/dpl.html
  • 52. Discussion  What can your software do instead of using accounts with default passwords?
  • 53. Discussion Sample Answers  What can your software do instead of using accounts with default passwords? – Functionality could be blocked until accounts are set properly (with appropriate notices so customer doesn't think that the program or equipment is broken) – If the default account can't be avoided, most functionality could be disabled until the default account is removed by the administrator.
  • 54. Hard-Coded Passwords  Open design security principle  Hard-coded passwords are a failure in the application of that principle – revealed password may result in a catastrophic failure  OEM requirements and ease-of-use may be at odds with this principle
  • 55. Wireless Access Points, Hard Drives, etc...  Does it sound reasonably safe to you to only allow configuration of these devices from a wireless PC, instead of requiring a wired connection? – Cisco access points  Serial connection available for less user friendly setup – Other brands
  • 56. Logging  Logging is an important, often requested security functional requirement – Especially if application has its own access control  Logging integrity – Append-only loggers – External loggers  Logging confidentiality issues (passwords) – Authority needed to view audit logs should be higher than the privilege to administer the product
  • 57. Attacks on Logs  Denial of service using chaff (junk; noise)  Semantic attacks (fake log entries)  Log entries with special characters  Log entries attempting to exploit vulnerabilities in the logging mechanism  Log entries attempting to exploit vulnerabilities in the log viewing mechanism  Logging second-hand or uncertain information – Spoofed identities  Write to syslog from any location on the network
  • 58. Log Denial-of-Service Attacks  CVE-1999-0566 An attacker can write to syslog files from any location, causing a denial of service by filling up the logs, and hiding activities. – Chaff attack  CVE-1999-0063 Cisco IOS 12.0 and other versions can be crashed by malicious UDP packets to the syslog port.  Solutions: Access control lists, firewall rules, etc...
  • 59. Example Logging Issues  CVE-2003-0020 Apache does not filter terminal escape sequences from its error logs, which could make it easier for attackers to insert those sequences into terminal emulators containing vulnerabilities related to escape sequences.  CVE-2003-0460 The rotatelogs program on Apache before 1.3.28, for Windows and OS/2 systems, does not properly ignore certain control characters that are received over the pipe, which could allow remote attackers to cause a denial of service.
  • 60. More Example Logging Issues  CVE-2001-1098 Cisco PIX firewall manager (PFM) 4.3(2)g records the enable password in plaintext to the pfm.log file, which could allow local users to obtain the password by reading the file.  CVE-2002-0113 Legato NetWorker 6.1 stores log files in the /nsr/logs/ directory with world-readable permissions, which allows local users to read sensitive information and potentially gain privileges.
  • 61. Yet More Example Logging Issues  CVE-2001-1403 Bugzilla versions prior to 2.14 – username and password from URLs recorded in logs  CVE-2001-0300 oidldapd 2.1.1.1 in Oracle 8.1.7 - local users can delete logs and/or overwrite other files via a symlink attack.  CVE-2001-0870 HTTP server in Alchemy Eye and Alchemy Network Monitor 1.9x through 2.6.18  CVE-2001-0908 CITRIX Metaframe 1.8
  • 62. Logging Mistakes!  CVE-2000-1179 Netopia ISDN Router 650-ST allowed unauthenticated remote attackers to read system logs using certain control characters.  CVE-2000-0967 PHP 3 and 4 did not properly cleanse user-injected format strings, allowing remote attackers to execute arbitrary commands by triggering error messages that were improperly written to the error logs.  CVE-2000-0642 The default configuration of WebActive HTTP Server 1.00 stores the web log active.log in the web server’s root document directory.
  • 63. Question  Logging can be attacked by: a) Exclusively using exploits that require an account on the local machine b) Using maliciously constructed data c) Exclusively using exploits that break an application that sends log data to the logging mechanism
  • 64. Question  Logging can be attacked by: a) Exclusively using exploits that require an account on the local machine b) Using maliciously constructed data c) Exclusively using exploits that break an application that sends log data to the logging mechanism
  • 65. Logging Defenses  Use different logs for: – Events  For users to see why their page/project/etc... failed  Per user log even better – Operations  Allow normal administrative supervision  e.g., "started at 9:32 PM"  e.g., "error reading configuration file at ..." – Audit  For sensitive information  e.g., Failed logins – Usernames – Passwords entered in username field » Both matched pairs usually available in audit log
  • 66. Calling External Programs  Wrappers  Calling paradigms – Shell – Special calls  Custom environment  File descriptors
  • 67. The Wrapper Problem  Calls to an insecure application can be wrapped inside and protected by another program that performs input validation and access control  Wrapper must have an exact and complete model of the grammar and semantics used by the protected application, otherwise: – Insecure application loses functionality – Wrapper lets through dangerous (“unexpected”) commands  Updates to an insecure application require an updated wrapper
  • 68. Example Wrapper Problem  wu-ftpd CVE-1999-0997 – FTP server  wu-ftp with FTP conversion enabled allows an attacker to execute commands via a malformed file name that is interpreted as an argument to the program that does the conversion, e.g. tar or uncompress. – Conversion is used to compress or uncompress files – File names passed to tar without checking if one really is a command line option that can be abused!  e.g., --use-compress-program <program>  e.g., --remove-files
  • 69. Wrapper Through Interpreted Code  When application is invoked by a command processed through a complex interpreter  Examples: – calling programs through the system() and wsystem() calls (UNIX and Windows) – other cases of dynamic code generation (SQL, etc...)  Modeling the interpreter is difficult. – “exec” family of UNIX calls presents a simplified interface that limits misinterpretations and engineered attacks. – Windows "CreateProcess*", "ShellExecute", "WinExec" have complex cases that allow engineered attacks
  • 70. Windows Call Complexity  CreateProcess ( lpApplicationName, lpCommandLine, ...)  If lpApplicationName is NULL, then lpCommandLine is interpreted... – Looks for an application name  White space separators  White space in directory names are "tried" as separators – C:Program FilesApplicationDirAppname.exe – C:Program.exe would get executed if present – Solution: enclose application in quotes, but why not specify lpApplicationName then? (From Howard and Leblanc, 2003)
  • 71. UNIX “system " Call  Program and arguments are interpreted by a shell! – very difficult to model and sanitize  Also available on Windows!  Exec calls – exect and execle allow the separation of path, arguments, and environment  Fewer risks – int exect(const char *path, char *const argv[], char *const envp[]);
  • 72. Question  execlp and execvp search the PATH like a shell does if the specified path is not absolute. Are they: a) As safe as execv b) Less safe than execv c) More safe than execv  int execv(const char *path, char *const argv[]);  int execvp(const char *file, char *const argv[]);
  • 73. Question  Rank the following calls in order of safety (high to low): – system – execle – execv – execvp a) execv, execvp, execle, system b) execle, execv, execvp, system c) execvp, execle, execv, system
  • 74. Question  Rank the following calls in order of safety (high to low): – system – execle – execv – execvp a) execv, execvp, execle, system b) execle, execv, execvp, system c) execvp, execle, execv, system
  • 75. File Descriptors  UNIX: forked and exec’ed processes inherit file descriptors  Remember the principle of complete mediation  Close all unneeded file descriptors (before calling exec)
  • 77. About These Slides  You are free to copy, distribute, display, and perform the work; and to make derivative works, under the following conditions. – You must give the original author and other contributors credit – The work will be used for personal or non-commercial educational uses only, and not for commercial activities and purposes – For any reuse or distribution, you must make clear to others the terms of use for this work – Derivative works must retain and be subject to the same conditions, and contain a note identifying the new contributor(s) and date of modification – For other uses please contact the Purdue Office of Technology Commercialization.  Developed thanks to the support of Symantec Corporation
  • 78. Pascal Meunier pmeunier@purdue.edu Contributors: Jared Robinson, Alan Krassowski, Craig Ozancin, Tim Brown, Wes Higaki, Melissa Dark, Chris Clifton, Gustavo Rodriguez-Rivera