Evaluating the [In]Security of Web Applications
Total Page:16
File Type:pdf, Size:1020Kb
Evaluating the [In]security of Web Applications José Carlos Coelho Martins da Fonseca Thesis for the degree of Doctor of Philosophy May 2011 Department of Informatics Engineering Faculty of Sciences and Technology University of Coimbra This research has been developed in the Software and Systems Engineering Group of the Center for Informatics and Systems of the University of Coimbra (CISUC). Funding for this work was partially provided by the Portuguese Research Agency Fundação para a Ciência e Tecnologia (FCT) through the scholarship SFRH/BD/36138/2007, by the Programa Operacional Potencial Humano (Human Potential Operational Programme)/Fundo Social Europeu (European Social Fund) and by the Portuguese Government/European Union through R&D Unit 326/94 CISUC. This work has been supervised by Professor Marco Paulo Amorim Vieira, Assistant Professor, and Professor Henrique Santos do Carmo Madeira, Full Professor of the Department of Informatics Engineering of the Faculty of Sciences and Technology of the University of Coimbra. iii ~ To my beloved grandfather Zeca ~ v Abstract The current dependency of modern enterprises on complex web applications raises new and challenging problems. Security (or the lack of it) is, certainly, one of the top concerns. Security issues have cascading effects within enterprises, with dramatic consequences to the dependability of the services they should provide. The impact of the successful exploitation of security breaches can be enormous and it may irreversibly affect the company competitiveness, brand, partners and clients. This thesis focuses on the study of the most significant web application vulnerabilities, proposing ways and solutions to improve the state of the art on web application security. One of the contributions is the classification and in-depth analysis of typical software bugs that lead to security vulnerabilities. For this purpose, we present a field study correlating common fault types in web application software with the potential vulnerabilities they may cause. A key contribution of the thesis is how we explore this relationship to propose new strategies to prevent, test and detect vulnerabilities using a mechanism to automatically inject vulnerabilities and attacks in web applications. We also propose and evaluate an intrusion detection system for databases that relies on the detection of the user activities that fall outside the profile of good behavior that was previously learned. The vulnerability injection and the attack injection approaches are based on real world observations so they are valuable frameworks in many security related scenarios, as they provide a true to life setup. With the vulnerability injection we propose new ways to train security assurance teams and our tests confirm the increased ability achieved to detect vulnerabilities, even outperforming top commercial tools. The attack injection was used to evaluate state of the art security tools. Results confirm that even top commercial tools still have a long way to go as they can only detect a very small percentage of the most critical vulnerabilities and attacks. The analysis of the outcome data can even provide important insights on the weaknesses of these tools, which is of major importance for their future improvement. Keywords: Attacks, Database Applications, Intrusion Detection Systems, Security, Security Evaluation, Security Tools, SQL Injection, Vulnerabilities, Web Applications, XSS. vii Resumo A actual dependência das empresas em aplicações web coloca novos problemas, sendo a segurança (ou a falta dela), certamente, um dos tópicos mais importantes. De facto, os problemas de segurança produzem efeitos em cascata dentro das empresas, afectando de uma forma avassaladora a confiança no serviço que deveriam fornecer. A exploração maliciosa de falhas de segurança tem um custo enorme e pode afectar irreversivelmente a competitividade e imagem da empresa, os seus parceiros e clientes. Esta tese centra-se no estudo das vulnerabilidades mais relevantes em aplicações web, propondo caminhos e soluções para melhorar o estado da arte da segurança na web. Uma contribuição é a classificação e análise em profundidade de erros de software típicos que produzem vulnerabilidades. Para tal, apresenta-se um estudo de campo que correlaciona os erros de software presentes em aplicações web com as potenciais vulnerabilidades que estes podem originar. Esta relação é explorada na proposta de novas estratégias para prevenir, testar e detectar vulnerabilidades. Neste sentido, são apresentadas técnicas inovadoras de injecção automática de vulnerabilidades e de injecção automática de ataques em aplicações web, as quais representam a contribuição mais relevante da tese. Para além disso, é proposto e avaliado um detector de intrusões para bases de dados que se baseia na detecção das actividades do utilizador que caem fora do perfil de boa conduta que foi previamente aprendido. A injecção automática de vulnerabilidades e de ataques permitiram construir ferramentas que, por serem baseadas em observações de campo, produzem resultados realistas. Usando a injecção de vulnerabilidades, propomos estratégias de treino de equipas de segurança, as quais levam a uma clara melhoria na capacidade de detecção de vulnerabilidades, suplantando mesmo ferramentas comerciais especializadas. Com a injecção de ataques foi possível analisar ferramentas usadas actualmente para detectar vulnerabilidades e ataques em aplicações web. Neste âmbito, observamos que as ferramentas existentes são ainda muito imperfeitas, tendo sido apontados futuros pontos a melhorar. Palavras Chave: Aplicações de Bases de Dados, Aplicações Web, Ataques, Avaliação de Segurança, Ferramentas de Segurança, Segurança, Sistemas de Detecção de Intrusões, SQL Injection, Vulnerabilidades, XSS. ix List of Papers This thesis relies on the published scientific research present in the following peer reviewed papers: P1. José Fonseca, Marco Vieira, Henrique Madeira, “Vulnerability & Attack Injection for Web Applications”, 39th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN 2009), Estoril, Lisbon, Portugal, June 29 - July 2, 2009, winner of the William Carter Award. P2. José Fonseca, Marco Vieira, Henrique Madeira, “Training Security Assurance Teams using Vulnerability Injection”, 14th IEEE Pacific Rim Dependable Computing conference (PRDC 2008), Taipei, Taiwan, December 15-17, 2008 P3. José Fonseca, Marco Vieira, “Mapping software faults with web security vulnerabilities”, 38th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN 2008), Anchorage, Alaska, USA, June 24-27, 2008 P4. José Fonseca, Marco Vieira, Henrique Madeira, “Online Detection of Malicious Data Access Using DBMS Auditing”, 23rd Annual ACM Symposium on Applied Computing (SAC 2008), Fortaleza, Ceará, Brazil, March 16-20, 2008 P5. José Fonseca, Marco Vieira, Henrique Madeira, “Testing and comparing web vulnerability scanning tools for SQL Injection and XSS attacks”, 13th IEEE Pacific Rim Dependable Computing conference (PRDC 2007), Melbourne, Victoria, Australia, December 17-19, 2007 P6. José Fonseca, Marco Vieira, Henrique Madeira, “Integrated Intrusion Detection in Databases”, Third Latin-American Symposium on Dependable Computing (LADC 2007), Morelia, Mexico, September 26- 28, 2007 P7. José Fonseca, Marco Vieira, Henrique Madeira, “Detecting Malicious SQL”, 4th International Conference on Trust, Privacy & Security in Digital Business (TrustBus 2007), Regensburg, Germany, September 3– 7, 2007 xi Preliminary versions of papers P5, P6 and P7 have been presented in the following short papers: P8. José Fonseca, Marco Vieira, Henrique Madeira, “Correlating security vulnerabilities with software faults”, Fast Abstract, 37th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN 2007), Edinburgh, UK, June 25-28, 2007 P9. José Fonseca, Marco Vieira, Henrique Madeira, “Monitoring Database Application Behavior for Intrusion Detection”, Short Paper, 12th IEEE International Symposium on Pacific Rim Dependable Computing (PRDC 2006) at University of California, Riverside, USA, December 18-20, 2006 P10. José Fonseca, “Intrusion Detection in Databases”, Student Forum, 36th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN 2006), Philadelphia, Pennsylvania, USA, June 25- 28, 2006 The following papers are related to this thesis but were not included: P11. Ivano Elia, José Fonseca, Marco Vieira, “Comparing SQL Injection Detection Tools Using Attack Injection: An Experimental Study”, The 21st annual International Symposium on Software Reliability Engineering (ISSRE 2010), Jan Jose, CA, USA, November 1-4, 2010 P12. José Fonseca, Marco Vieira, Henrique Madeira, “The Web Attacker Perspective – A Field Study”, The 21st annual International Symposium on Software Reliability Engineering (ISSRE 2010), Jan Jose, CA, USA, November 1-4, 2010 P13. Nuno Seixas, José Fonseca, Marco Vieira, Henrique Madeira, “Looking at Web Security Vulnerabilities from the Programming Language Perspective: A Field Study”, The 20th annual International Symposium on Software Reliability Engineering (ISSRE 2009), Mysuru, India, November 16-19, 2009 xii Award As a result of the research done during the work addressed on this thesis, the paper “Vulnerability & Attack Injection for Web Applications” (P1), presented at the Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN 2009) won the William C. Carter Award [IEEE TC-FCT