SlideShare uma empresa Scribd logo
1 de 45
SPARQL Injection
                          attacking the triple store

                              Simone                      Luca
                              Onofri                    Napolitano



OWASP-Italy Day2012
Rome, 23° November 2012



                             Copyright © 2008 - The OWASP Foundation
                             Permission is granted to copy, distribute and/or modify this document
                             under the terms of the GNU Free Documentation License.




                             The OWASP Foundation
                             http://www.owasp.org
Agenda

!     Introduzione al Web Semantico
!     Cos’è SPARQL
!     SPARQL Injection
!     Demo
!     Oltre la SPARQL Injection
!     Conclusioni




OWASP-Italy Day 2012                  OWASP
Chi siamo

!   Simone Onofri               !   Luca Napolitano
    10 anni di consulenza         8 anni di consulenza
    in ambito sicurezza,           in ambito sicurezza,
    applicazioni, web              applicazioni, reti…
    semantico…                     Sviluppo di strumenti
    Attivo in associazioni e      a supporto della
    organizzazioni per la          gestione delle
    sicurezza e tematiche          vulnerabilità
    affini                         Network & Security
    Senior Consultant /           Specialist per grandi
    Project Manager per            aziende
    Techub S.p.A.

OWASP-Italy Day 2012                              OWASP
Introduzione
            al
       Web Semantico

OWASP-Italy Day 2012   OWASP
Web Semantico – Cenni storici

!   Teorizzato da Tim Berners-Lee negli anni ‘90
!   In teoria
    Estende il web attuale
    Una rete di dati che descrive dati
!   In pratica
    Si basa su asserzioni
    Utilizza la logica dei predicati del primo ordine
    Triplette di dati (soggetto, predicato, oggetto)
    RDF (Resource Description Framework)



OWASP-Italy Day 2012                                 OWASP
Web Semantico – RDF: Struttura



        Io mi chiamo Simone




OWASP-Italy Day 2012             OWASP
Web Semantico – RDF: Soggetto




                  Io
         <http://onofri.org/>
              Soggetto


OWASP-Italy Day 2012            OWASP
Web Semantico – RDF: Predicato




                       Mi chiamo
                       foaf:name
                       Predicato


OWASP-Italy Day 2012               OWASP
Web Semantico – RDF: Oggetto




                        Simone
                       “Simone”
                       Oggetto


OWASP-Italy Day 2012              OWASP
Web Semantico – Triplette: foaf:name




 <http://onofri.org/>
      foaf:name
                       “Simone”.

OWASP-Italy Day 2012                   OWASP
Web Semantico: Triple Store




OWASP-Italy Day 2012          OWASP
Web Semantico - Tecnologie




OWASP-Italy Day 2012         OWASP
Web Semantico – Prospettive: Open Data




OWASP-Italy Day 2012               OWASP
Web Semantico – Prospettive: Big Data




     BIG
     DATA
OWASP-Italy Day 2012                OWASP
Cos’è SPARQL


OWASP-Italy Day 2012   OWASP
SPARQL - Acronimo




SPARQL Protocol
And RDF Query
   Language
OWASP-Italy Day 2012   OWASP
SPARQL – Un linguaggio completo (v1.1)

!   Tipologie di Query
    SELECT, CONSTRUCT, ASK, DESCRIBE, UPDATE,
    DROP , COPY, MOVE, ADD
!   Modificatori
    ORDER BY, OFFSET, LIMIT, HAVING
!   Espressioni
    IF, COALESCE, EXISTS, IN, NOT, logiche
!   Pattern
    FILTER, OPTIONAL
!   Funzioni
    Stringhe, date, numeri, hash, xpath, xquery
OWASP-Italy Day 2012                               OWASP
SPARQL – Sintassi: Literals e IRI
! Literals: Stringhe
      All’interno di virgolette doppie (“) o singole (‘)
      Lingua (es. @it) opzionale
      Tipo di dato, tramite un IRI (es. ^^xsd:integer)
       opzionale
     (es. “Simone”@it oppure
     “2012-11-23”^^xsd:date)
!   IRI: Internationalized Resource Identifier
      All’interno di parentesti angolari (es. <http://
       owasp.org/>)
      oppure attraverso i prefissi (es. PREFIX foaf:
       <http://xmlns.com/foaf/0.1/> e foaf:name
       sta per <http://xmlns.com/foaf/0.1/name>)
OWASP-Italy Day 2012                             OWASP
SPARQL – Sintassi: Commento (in linea)




  “I commenti nelle query SPARQL hanno la
forma di un '#', al di fuori di un IRI o di una
stringa, i commenti sono solo in linea (fino
ai caratteri 0x0D o 0x0A) oppure fino alla fine
      del file se non ci sono nuove righe.”



OWASP-Italy Day 2012                   OWASP
SPARQL – Query di base

PREFIX foaf: <http://xmlns.com/
foaf/0.1/>
SELECT ?name # query pattern
WHERE {
?person foaf:name ?name . FILTER
regex(?name, "^S", ”i")
}
LIMIT 10 # query modifiers

OWASP-Italy Day 2012        OWASP
SPARQL – Risposta di base

?name
Sabrina
Sestio
Simone
…




OWASP-Italy Day 2012        OWASP
SPARQL Injection


OWASP-Italy Day 2012   OWASP
SPARQL Injection – cenni storici

!   2005-2008 – SPARQL 1.0

!   2008 (Aprile) – SPARQL Injection

!   2009-presente – SPARQL 1.1




OWASP-Italy Day 2012                   OWASP
SPARQL Injection – Cheatsheet
!   All’interno del WHERE con un literals
    “# Commento con virgoletta doppie
    ‘# Commento con virgoletta
!   All’interno del WHERE con un IRI
    ># Parentesi angolare
!   All’interno dei FILTER
    ‘) # e “)# Vengono usate le parentesi, una o più
    All’interno di una regex
!   In generale
    . Terminazione di tripletta
    ; Per annidare le triplette

OWASP-Italy Day 2012                             OWASP
SPARQL Injection – Struttura di una app




OWASP-Italy Day 2012                 OWASP
SPARQL Injection – Dove?
PREFIX dbpedia: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>



SELECT ?film ?date
WHERE {
?film rdf:type dbpedia:Film .
?film rdfs:label ?title .
?film dbpedia:releaseDate ?date .
FILTER ((?date >= "2000-01-01"^^xsd:date)
&& (?date < "2012-02-01"^^xsd:date) &&
regex(str(?title), "^R"))
}
OWASP-Italy Day 2012                                    OWASP
SPARQL Injection – Conclusioni
!   L’impatto varia secondo
    La struttura della query
    Dov’è possibile inserire il codice
    Utilizzo di comandi dai vari dialetti (es. LOAD)
!   Non solo SPARQL Injection
    Xquery
    Xpath
    Regex
!   Mitigazione
    Query Parametriche
    Validazione dei dati
    Scrivere SPARQL correttamente
OWASP-Italy Day 2012                                OWASP
Demo


OWASP-Italy Day 2012          OWASP
Demo – Semantic Login: Schermata




OWASP-Italy Day 2012               OWASP
Demo – Semantic Login: Codice




OWASP-Italy Day 2012            OWASP
Demo – Semantic Login: richiesta (legit)




OWASP-Italy Day 2012                  OWASP
Demo – Semantic Login: risposta (legit)




OWASP-Italy Day 2012                 OWASP
Demo – Semantic Login: richiesta (injection)




OWASP-Italy Day 2012                  OWASP
Demo – Semantic Login: risposta (injection)




OWASP-Italy Day 2012                 OWASP
SPARQL Injection – Dov’è il bug




OWASP-Italy Day 2012              OWASP
Oltre la SPARQL
         Injection

OWASP-Italy Day 2012   OWASP
Oltre la SPARQL Injection – dietro…




OWASP-Italy Day 2012                  OWASP
Oltre la SPARQL Injection – SQL Injection




OWASP-Italy Day 2012                 OWASP
Oltre la SPARQL Injection - Query SPARQL




PREFIX iam: <http://x>
SELECT * WHERE {
   ?user iam:user "lol*/ OR (SELECT
sleep(5))=1--" .
}
LIMIT 100



OWASP-Italy Day 2012                OWASP
Oltre la SPARQL Injection - Query SQL


SELECT
     T_0_0_0.s AS `user`,
     T_0_0_0.s_type AS `user type`
FROM arc_tests_triple T_0_0_0
WHERE (T_0_0_0.p = 0) /* http://xuser
*/
   AND (T_0_0_0.o = 0) /* lol*/ OR
(SELECT sleep(5))=1-- */
LIMIT 100

OWASP-Italy Day 2012                    OWASP
Bonus – Dov’è il bug




OWASP-Italy Day 2012   OWASP
Oltre la SPARQL Injection – Dettagli



         ARC v2011-12-01 Multiple
              vulnerabilities

            http://onofri.org/u/arc2012
            http://onofri.org/u/vm2012


OWASP-Italy Day 2012                      OWASP
Conclusioni


OWASP-Italy Day 2012          OWASP
Grazie! Domande?

!   Simone Onofri            !   Luca Napolitano
   simone.onofri@gmail.com      beinux3@gmail.com

   @simoneonofri                @beinux3




          http://onofri.org/u/sparqli2012


OWASP-Italy Day 2012                          OWASP
Riferimenti

!   Tim Berners-Lee - Weaving the Web
   http://www.w3.org/People/Berners-Lee/Weaving/Overview.html

!   W3 - SPARQL Query Language for RDF
   http://www.w3.org/TR/rdf-sparql-query/

!   SPARQL 1.1 Query Language
   http://www.w3.org/TR/sparql11-query/

!   Code Injection
   http://www.morelab.deusto.es/code_injection/




OWASP-Italy Day 2012                                        OWASP

Mais conteúdo relacionado

Destaque

Introduzione al Web Semantico: URI, XML, RDF, SPARQL, RDFS, OWL
Introduzione al Web Semantico: URI, XML, RDF, SPARQL, RDFS, OWLIntroduzione al Web Semantico: URI, XML, RDF, SPARQL, RDFS, OWL
Introduzione al Web Semantico: URI, XML, RDF, SPARQL, RDFS, OWLSimone Onofri
 
Netiquette e uso ragionato di internet e delle nuove tecnologie
Netiquette e uso ragionato di internet e delle nuove tecnologieNetiquette e uso ragionato di internet e delle nuove tecnologie
Netiquette e uso ragionato di internet e delle nuove tecnologieSimone Onofri
 
Web Semantico: da XHTML a RDF in 3 click
Web Semantico: da XHTML a RDF in 3 clickWeb Semantico: da XHTML a RDF in 3 click
Web Semantico: da XHTML a RDF in 3 clickSimone Onofri
 
ITSMF Conferenza 2014 - L'officina Agile per innovare l'IT Service Management
ITSMF Conferenza 2014 - L'officina Agile per innovare l'IT Service ManagementITSMF Conferenza 2014 - L'officina Agile per innovare l'IT Service Management
ITSMF Conferenza 2014 - L'officina Agile per innovare l'IT Service ManagementSimone Onofri
 
Il Web del Futuro: Enterprise e Web Semantico
Il Web del Futuro: Enterprise e Web SemanticoIl Web del Futuro: Enterprise e Web Semantico
Il Web del Futuro: Enterprise e Web SemanticoSimone Onofri
 
Lean Startup Machine - Rome - Agile e Lean Project Management
Lean Startup Machine - Rome - Agile e Lean Project ManagementLean Startup Machine - Rome - Agile e Lean Project Management
Lean Startup Machine - Rome - Agile e Lean Project ManagementSimone Onofri
 
Il Web Del Futuro Visioni E Idee Sul Web Semantico
Il  Web Del Futuro    Visioni E  Idee Sul  Web  SemanticoIl  Web Del Futuro    Visioni E  Idee Sul  Web  Semantico
Il Web Del Futuro Visioni E Idee Sul Web SemanticoSimone Onofri
 
Hackers vs Developers: vulnerabilità e soluzioni nello sviluppo di applicazio...
Hackers vs Developers: vulnerabilità e soluzioni nello sviluppo di applicazio...Hackers vs Developers: vulnerabilità e soluzioni nello sviluppo di applicazio...
Hackers vs Developers: vulnerabilità e soluzioni nello sviluppo di applicazio...Simone Onofri
 
Hackers vs Developers - SQL Injection - Attacco e Difesa
Hackers vs Developers - SQL Injection - Attacco e DifesaHackers vs Developers - SQL Injection - Attacco e Difesa
Hackers vs Developers - SQL Injection - Attacco e DifesaSimone Onofri
 
Gli HTTP Security Header e altri elementi da sapere su HTTP in un Web Applica...
Gli HTTP Security Header e altri elementi da sapere su HTTP in un Web Applica...Gli HTTP Security Header e altri elementi da sapere su HTTP in un Web Applica...
Gli HTTP Security Header e altri elementi da sapere su HTTP in un Web Applica...Simone Onofri
 
Mamma, da grande voglio essere un Penetration Tester HackInBo 2016 Winter
Mamma, da grande voglio essere un Penetration Tester HackInBo  2016 WinterMamma, da grande voglio essere un Penetration Tester HackInBo  2016 Winter
Mamma, da grande voglio essere un Penetration Tester HackInBo 2016 WinterSimone Onofri
 
Hackers vs Developers - Nuove e vecchie vulnerabilità con la OWASP TOP 10 2013
Hackers vs Developers - Nuove e vecchie vulnerabilità con la OWASP TOP 10 2013Hackers vs Developers - Nuove e vecchie vulnerabilità con la OWASP TOP 10 2013
Hackers vs Developers - Nuove e vecchie vulnerabilità con la OWASP TOP 10 2013Simone Onofri
 
Project management: Gestire progetto web con Agilità (con DSDM, Agile Project...
Project management: Gestire progetto web con Agilità (con DSDM, Agile Project...Project management: Gestire progetto web con Agilità (con DSDM, Agile Project...
Project management: Gestire progetto web con Agilità (con DSDM, Agile Project...Simone Onofri
 
Agile Lean Management - MoSCoW, Timeboxing e Kanban
Agile Lean Management - MoSCoW, Timeboxing e KanbanAgile Lean Management - MoSCoW, Timeboxing e Kanban
Agile Lean Management - MoSCoW, Timeboxing e KanbanSimone Onofri
 
TEDX TorVergataU - Intuition, Hacking e Nuove Tecnologie
TEDX TorVergataU -  Intuition, Hacking e Nuove TecnologieTEDX TorVergataU -  Intuition, Hacking e Nuove Tecnologie
TEDX TorVergataU - Intuition, Hacking e Nuove TecnologieSimone Onofri
 
Agile e Lean Management
 Agile e Lean Management Agile e Lean Management
Agile e Lean ManagementSimone Onofri
 
Il Web del Futuro Web Marketing e Web Semantico semarketing
Il Web del Futuro Web Marketing e Web Semantico semarketingIl Web del Futuro Web Marketing e Web Semantico semarketing
Il Web del Futuro Web Marketing e Web Semantico semarketingSimone Onofri
 
Penetration Testing con Python - Network Sniffer
Penetration Testing con Python - Network SnifferPenetration Testing con Python - Network Sniffer
Penetration Testing con Python - Network SnifferSimone Onofri
 

Destaque (19)

HTML5 Security
HTML5 SecurityHTML5 Security
HTML5 Security
 
Introduzione al Web Semantico: URI, XML, RDF, SPARQL, RDFS, OWL
Introduzione al Web Semantico: URI, XML, RDF, SPARQL, RDFS, OWLIntroduzione al Web Semantico: URI, XML, RDF, SPARQL, RDFS, OWL
Introduzione al Web Semantico: URI, XML, RDF, SPARQL, RDFS, OWL
 
Netiquette e uso ragionato di internet e delle nuove tecnologie
Netiquette e uso ragionato di internet e delle nuove tecnologieNetiquette e uso ragionato di internet e delle nuove tecnologie
Netiquette e uso ragionato di internet e delle nuove tecnologie
 
Web Semantico: da XHTML a RDF in 3 click
Web Semantico: da XHTML a RDF in 3 clickWeb Semantico: da XHTML a RDF in 3 click
Web Semantico: da XHTML a RDF in 3 click
 
ITSMF Conferenza 2014 - L'officina Agile per innovare l'IT Service Management
ITSMF Conferenza 2014 - L'officina Agile per innovare l'IT Service ManagementITSMF Conferenza 2014 - L'officina Agile per innovare l'IT Service Management
ITSMF Conferenza 2014 - L'officina Agile per innovare l'IT Service Management
 
Il Web del Futuro: Enterprise e Web Semantico
Il Web del Futuro: Enterprise e Web SemanticoIl Web del Futuro: Enterprise e Web Semantico
Il Web del Futuro: Enterprise e Web Semantico
 
Lean Startup Machine - Rome - Agile e Lean Project Management
Lean Startup Machine - Rome - Agile e Lean Project ManagementLean Startup Machine - Rome - Agile e Lean Project Management
Lean Startup Machine - Rome - Agile e Lean Project Management
 
Il Web Del Futuro Visioni E Idee Sul Web Semantico
Il  Web Del Futuro    Visioni E  Idee Sul  Web  SemanticoIl  Web Del Futuro    Visioni E  Idee Sul  Web  Semantico
Il Web Del Futuro Visioni E Idee Sul Web Semantico
 
Hackers vs Developers: vulnerabilità e soluzioni nello sviluppo di applicazio...
Hackers vs Developers: vulnerabilità e soluzioni nello sviluppo di applicazio...Hackers vs Developers: vulnerabilità e soluzioni nello sviluppo di applicazio...
Hackers vs Developers: vulnerabilità e soluzioni nello sviluppo di applicazio...
 
Hackers vs Developers - SQL Injection - Attacco e Difesa
Hackers vs Developers - SQL Injection - Attacco e DifesaHackers vs Developers - SQL Injection - Attacco e Difesa
Hackers vs Developers - SQL Injection - Attacco e Difesa
 
Gli HTTP Security Header e altri elementi da sapere su HTTP in un Web Applica...
Gli HTTP Security Header e altri elementi da sapere su HTTP in un Web Applica...Gli HTTP Security Header e altri elementi da sapere su HTTP in un Web Applica...
Gli HTTP Security Header e altri elementi da sapere su HTTP in un Web Applica...
 
Mamma, da grande voglio essere un Penetration Tester HackInBo 2016 Winter
Mamma, da grande voglio essere un Penetration Tester HackInBo  2016 WinterMamma, da grande voglio essere un Penetration Tester HackInBo  2016 Winter
Mamma, da grande voglio essere un Penetration Tester HackInBo 2016 Winter
 
Hackers vs Developers - Nuove e vecchie vulnerabilità con la OWASP TOP 10 2013
Hackers vs Developers - Nuove e vecchie vulnerabilità con la OWASP TOP 10 2013Hackers vs Developers - Nuove e vecchie vulnerabilità con la OWASP TOP 10 2013
Hackers vs Developers - Nuove e vecchie vulnerabilità con la OWASP TOP 10 2013
 
Project management: Gestire progetto web con Agilità (con DSDM, Agile Project...
Project management: Gestire progetto web con Agilità (con DSDM, Agile Project...Project management: Gestire progetto web con Agilità (con DSDM, Agile Project...
Project management: Gestire progetto web con Agilità (con DSDM, Agile Project...
 
Agile Lean Management - MoSCoW, Timeboxing e Kanban
Agile Lean Management - MoSCoW, Timeboxing e KanbanAgile Lean Management - MoSCoW, Timeboxing e Kanban
Agile Lean Management - MoSCoW, Timeboxing e Kanban
 
TEDX TorVergataU - Intuition, Hacking e Nuove Tecnologie
TEDX TorVergataU -  Intuition, Hacking e Nuove TecnologieTEDX TorVergataU -  Intuition, Hacking e Nuove Tecnologie
TEDX TorVergataU - Intuition, Hacking e Nuove Tecnologie
 
Agile e Lean Management
 Agile e Lean Management Agile e Lean Management
Agile e Lean Management
 
Il Web del Futuro Web Marketing e Web Semantico semarketing
Il Web del Futuro Web Marketing e Web Semantico semarketingIl Web del Futuro Web Marketing e Web Semantico semarketing
Il Web del Futuro Web Marketing e Web Semantico semarketing
 
Penetration Testing con Python - Network Sniffer
Penetration Testing con Python - Network SnifferPenetration Testing con Python - Network Sniffer
Penetration Testing con Python - Network Sniffer
 

Semelhante a Owasp italy day sparql injection attacking triple store semantic web application security sql injection

Come mettere in sicurezza le applicazioni legacy, un approccio pragmatico
Come mettere in sicurezza le applicazioni legacy, un approccio pragmaticoCome mettere in sicurezza le applicazioni legacy, un approccio pragmatico
Come mettere in sicurezza le applicazioni legacy, un approccio pragmaticoAntonio Parata
 
Il "Knowledge Graph" della Pubblica Amministrazione Italiana
Il "Knowledge Graph" della Pubblica Amministrazione ItalianaIl "Knowledge Graph" della Pubblica Amministrazione Italiana
Il "Knowledge Graph" della Pubblica Amministrazione ItalianaGraphRM
 
Sacchi - TASI - Semantic Web
Sacchi - TASI - Semantic WebSacchi - TASI - Semantic Web
Sacchi - TASI - Semantic WebMichael Sacchi
 
OntoPiA la rete di ontologie e vocabolari controllati per la pubblica amminis...
OntoPiA la rete di ontologie e vocabolari controllati per la pubblica amminis...OntoPiA la rete di ontologie e vocabolari controllati per la pubblica amminis...
OntoPiA la rete di ontologie e vocabolari controllati per la pubblica amminis...Giorgia Lodi
 
Solimena Dellafiore - Applicazioni RESTful con Jersey : come realizzare un mi...
Solimena Dellafiore - Applicazioni RESTful con Jersey : come realizzare un mi...Solimena Dellafiore - Applicazioni RESTful con Jersey : come realizzare un mi...
Solimena Dellafiore - Applicazioni RESTful con Jersey : come realizzare un mi...Riccardo Solimena
 
Integrare Apache Solr in TYPO3
Integrare Apache Solr in TYPO3Integrare Apache Solr in TYPO3
Integrare Apache Solr in TYPO3Mauro Lorenzutti
 
Introduzione a Ruby On Rails
Introduzione a Ruby On RailsIntroduzione a Ruby On Rails
Introduzione a Ruby On RailsLuca Mearelli
 
Scala: come recuperare la programmazione funzionale e perché
Scala: come recuperare la programmazione funzionale e perchéScala: come recuperare la programmazione funzionale e perché
Scala: come recuperare la programmazione funzionale e perchéEdmondo Porcu
 
Progetti Open Source Per La Sicurezza Delle Web Applications
Progetti Open Source Per La Sicurezza Delle Web ApplicationsProgetti Open Source Per La Sicurezza Delle Web Applications
Progetti Open Source Per La Sicurezza Delle Web ApplicationsMarco Morana
 
LOD, SPARQL e dintorni
LOD, SPARQL e dintorniLOD, SPARQL e dintorni
LOD, SPARQL e dintorninvitucci
 
Workshop paas - ECDay 23 Maggio 2012
Workshop paas - ECDay 23 Maggio 2012Workshop paas - ECDay 23 Maggio 2012
Workshop paas - ECDay 23 Maggio 2012VMEngine
 
Fabio Cecaro - WorkShop PaaS – Platform as a Services
Fabio Cecaro - WorkShop PaaS – Platform as a ServicesFabio Cecaro - WorkShop PaaS – Platform as a Services
Fabio Cecaro - WorkShop PaaS – Platform as a ServicesFondazione CUOA
 

Semelhante a Owasp italy day sparql injection attacking triple store semantic web application security sql injection (20)

Tesi1
Tesi1Tesi1
Tesi1
 
Come mettere in sicurezza le applicazioni legacy, un approccio pragmatico
Come mettere in sicurezza le applicazioni legacy, un approccio pragmaticoCome mettere in sicurezza le applicazioni legacy, un approccio pragmatico
Come mettere in sicurezza le applicazioni legacy, un approccio pragmatico
 
Ajaxare WordPress
Ajaxare WordPressAjaxare WordPress
Ajaxare WordPress
 
Owasp Day 3
Owasp Day 3Owasp Day 3
Owasp Day 3
 
Il "Knowledge Graph" della Pubblica Amministrazione Italiana
Il "Knowledge Graph" della Pubblica Amministrazione ItalianaIl "Knowledge Graph" della Pubblica Amministrazione Italiana
Il "Knowledge Graph" della Pubblica Amministrazione Italiana
 
Sacchi - TASI - Semantic Web
Sacchi - TASI - Semantic WebSacchi - TASI - Semantic Web
Sacchi - TASI - Semantic Web
 
OntoPiA la rete di ontologie e vocabolari controllati per la pubblica amminis...
OntoPiA la rete di ontologie e vocabolari controllati per la pubblica amminis...OntoPiA la rete di ontologie e vocabolari controllati per la pubblica amminis...
OntoPiA la rete di ontologie e vocabolari controllati per la pubblica amminis...
 
Odatv alessandra donnini
Odatv alessandra donniniOdatv alessandra donnini
Odatv alessandra donnini
 
Solimena Dellafiore - Applicazioni RESTful con Jersey : come realizzare un mi...
Solimena Dellafiore - Applicazioni RESTful con Jersey : come realizzare un mi...Solimena Dellafiore - Applicazioni RESTful con Jersey : come realizzare un mi...
Solimena Dellafiore - Applicazioni RESTful con Jersey : come realizzare un mi...
 
Integrare Apache Solr in TYPO3
Integrare Apache Solr in TYPO3Integrare Apache Solr in TYPO3
Integrare Apache Solr in TYPO3
 
Introduzione a Ruby On Rails
Introduzione a Ruby On RailsIntroduzione a Ruby On Rails
Introduzione a Ruby On Rails
 
Drupal + Apache SOLR
Drupal + Apache SOLRDrupal + Apache SOLR
Drupal + Apache SOLR
 
Scala: come recuperare la programmazione funzionale e perché
Scala: come recuperare la programmazione funzionale e perchéScala: come recuperare la programmazione funzionale e perché
Scala: come recuperare la programmazione funzionale e perché
 
Infosecurity 2007
Infosecurity 2007Infosecurity 2007
Infosecurity 2007
 
Progetti Open Source Per La Sicurezza Delle Web Applications
Progetti Open Source Per La Sicurezza Delle Web ApplicationsProgetti Open Source Per La Sicurezza Delle Web Applications
Progetti Open Source Per La Sicurezza Delle Web Applications
 
LOD, SPARQL e dintorni
LOD, SPARQL e dintorniLOD, SPARQL e dintorni
LOD, SPARQL e dintorni
 
Maven Eclipse
Maven EclipseMaven Eclipse
Maven Eclipse
 
Owasp parte1-rel1.1
Owasp parte1-rel1.1Owasp parte1-rel1.1
Owasp parte1-rel1.1
 
Workshop paas - ECDay 23 Maggio 2012
Workshop paas - ECDay 23 Maggio 2012Workshop paas - ECDay 23 Maggio 2012
Workshop paas - ECDay 23 Maggio 2012
 
Fabio Cecaro - WorkShop PaaS – Platform as a Services
Fabio Cecaro - WorkShop PaaS – Platform as a ServicesFabio Cecaro - WorkShop PaaS – Platform as a Services
Fabio Cecaro - WorkShop PaaS – Platform as a Services
 

Mais de Simone Onofri

Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101Simone Onofri
 
Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day Simone Onofri
 
Attacking Ethereum Smart Contracts a deep dive after ~9 years of deployment
Attacking Ethereum Smart Contracts  a deep dive after ~9 years of deploymentAttacking Ethereum Smart Contracts  a deep dive after ~9 years of deployment
Attacking Ethereum Smart Contracts a deep dive after ~9 years of deploymentSimone Onofri
 
Linux Day 2018 Roma - Web Application Penetration Test (WAPT) con Linux
Linux Day 2018 Roma - Web Application Penetration Test (WAPT) con LinuxLinux Day 2018 Roma - Web Application Penetration Test (WAPT) con Linux
Linux Day 2018 Roma - Web Application Penetration Test (WAPT) con LinuxSimone Onofri
 
Agile Lean Conference 2017 - Leadership e facilitazione
Agile Lean Conference 2017 - Leadership e facilitazioneAgile Lean Conference 2017 - Leadership e facilitazione
Agile Lean Conference 2017 - Leadership e facilitazioneSimone Onofri
 
Agile Business Consortium - LEGO SERIOUS PLAY e i Principi di Agile Project M...
Agile Business Consortium - LEGO SERIOUS PLAY e i Principi di Agile Project M...Agile Business Consortium - LEGO SERIOUS PLAY e i Principi di Agile Project M...
Agile Business Consortium - LEGO SERIOUS PLAY e i Principi di Agile Project M...Simone Onofri
 
Agile Project Framework
Agile Project FrameworkAgile Project Framework
Agile Project FrameworkSimone Onofri
 
Agile nei servizi di cyber security (Security Summit Edition)
Agile nei servizi di cyber security (Security Summit Edition)Agile nei servizi di cyber security (Security Summit Edition)
Agile nei servizi di cyber security (Security Summit Edition)Simone Onofri
 
Security Project Management - Agile nei servizi di Cyber Security
Security Project Management - Agile nei servizi di Cyber SecuritySecurity Project Management - Agile nei servizi di Cyber Security
Security Project Management - Agile nei servizi di Cyber SecuritySimone Onofri
 
Cyber Defense - How to find and manage zero-days
Cyber Defense - How to find and manage zero-days Cyber Defense - How to find and manage zero-days
Cyber Defense - How to find and manage zero-days Simone Onofri
 
Cyber Defense - How to be prepared to APT
Cyber Defense - How to be prepared to APTCyber Defense - How to be prepared to APT
Cyber Defense - How to be prepared to APTSimone Onofri
 
ISACA - Gestire progetti di Ethical Hacking secondo le best practices
ISACA - Gestire progetti di Ethical Hacking secondo le best practicesISACA - Gestire progetti di Ethical Hacking secondo le best practices
ISACA - Gestire progetti di Ethical Hacking secondo le best practicesSimone Onofri
 
OWASP AppSec EU 2016 - Security Project Management - How to be Agile in Secu...
OWASP AppSec EU 2016 - Security Project Management -  How to be Agile in Secu...OWASP AppSec EU 2016 - Security Project Management -  How to be Agile in Secu...
OWASP AppSec EU 2016 - Security Project Management - How to be Agile in Secu...Simone Onofri
 
Nuove minacce nella Cyber Security, come proteggersi
Nuove minacce nella Cyber Security, come proteggersiNuove minacce nella Cyber Security, come proteggersi
Nuove minacce nella Cyber Security, come proteggersiSimone Onofri
 
Hackers vs Developers - Cross Site Scripting (XSS) Attacco e difesa
Hackers vs Developers - Cross Site Scripting (XSS) Attacco e difesaHackers vs Developers - Cross Site Scripting (XSS) Attacco e difesa
Hackers vs Developers - Cross Site Scripting (XSS) Attacco e difesaSimone Onofri
 
Agile lean conference - Agile, Lean & Business
Agile lean conference - Agile, Lean & BusinessAgile lean conference - Agile, Lean & Business
Agile lean conference - Agile, Lean & BusinessSimone Onofri
 
IPMA 2014 World Congress - Stakeholder Engagement between Traditional and Ag...
IPMA 2014 World Congress -  Stakeholder Engagement between Traditional and Ag...IPMA 2014 World Congress -  Stakeholder Engagement between Traditional and Ag...
IPMA 2014 World Congress - Stakeholder Engagement between Traditional and Ag...Simone Onofri
 
Meetmagento 2014 hackers_onofri
Meetmagento 2014 hackers_onofriMeetmagento 2014 hackers_onofri
Meetmagento 2014 hackers_onofriSimone Onofri
 

Mais de Simone Onofri (19)

Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
Attacking and Exploiting Ethereum Smart Contracts: Auditing 101
 
Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
 
Attacking Ethereum Smart Contracts a deep dive after ~9 years of deployment
Attacking Ethereum Smart Contracts  a deep dive after ~9 years of deploymentAttacking Ethereum Smart Contracts  a deep dive after ~9 years of deployment
Attacking Ethereum Smart Contracts a deep dive after ~9 years of deployment
 
Linux Day 2018 Roma - Web Application Penetration Test (WAPT) con Linux
Linux Day 2018 Roma - Web Application Penetration Test (WAPT) con LinuxLinux Day 2018 Roma - Web Application Penetration Test (WAPT) con Linux
Linux Day 2018 Roma - Web Application Penetration Test (WAPT) con Linux
 
Agile Lean Conference 2017 - Leadership e facilitazione
Agile Lean Conference 2017 - Leadership e facilitazioneAgile Lean Conference 2017 - Leadership e facilitazione
Agile Lean Conference 2017 - Leadership e facilitazione
 
Agile Business Consortium - LEGO SERIOUS PLAY e i Principi di Agile Project M...
Agile Business Consortium - LEGO SERIOUS PLAY e i Principi di Agile Project M...Agile Business Consortium - LEGO SERIOUS PLAY e i Principi di Agile Project M...
Agile Business Consortium - LEGO SERIOUS PLAY e i Principi di Agile Project M...
 
Agile Project Framework
Agile Project FrameworkAgile Project Framework
Agile Project Framework
 
Agile nei servizi di cyber security (Security Summit Edition)
Agile nei servizi di cyber security (Security Summit Edition)Agile nei servizi di cyber security (Security Summit Edition)
Agile nei servizi di cyber security (Security Summit Edition)
 
Security Project Management - Agile nei servizi di Cyber Security
Security Project Management - Agile nei servizi di Cyber SecuritySecurity Project Management - Agile nei servizi di Cyber Security
Security Project Management - Agile nei servizi di Cyber Security
 
Cyber Defense - How to find and manage zero-days
Cyber Defense - How to find and manage zero-days Cyber Defense - How to find and manage zero-days
Cyber Defense - How to find and manage zero-days
 
Cyber Defense - How to be prepared to APT
Cyber Defense - How to be prepared to APTCyber Defense - How to be prepared to APT
Cyber Defense - How to be prepared to APT
 
ISACA - Gestire progetti di Ethical Hacking secondo le best practices
ISACA - Gestire progetti di Ethical Hacking secondo le best practicesISACA - Gestire progetti di Ethical Hacking secondo le best practices
ISACA - Gestire progetti di Ethical Hacking secondo le best practices
 
OWASP AppSec EU 2016 - Security Project Management - How to be Agile in Secu...
OWASP AppSec EU 2016 - Security Project Management -  How to be Agile in Secu...OWASP AppSec EU 2016 - Security Project Management -  How to be Agile in Secu...
OWASP AppSec EU 2016 - Security Project Management - How to be Agile in Secu...
 
ORM Injection
ORM InjectionORM Injection
ORM Injection
 
Nuove minacce nella Cyber Security, come proteggersi
Nuove minacce nella Cyber Security, come proteggersiNuove minacce nella Cyber Security, come proteggersi
Nuove minacce nella Cyber Security, come proteggersi
 
Hackers vs Developers - Cross Site Scripting (XSS) Attacco e difesa
Hackers vs Developers - Cross Site Scripting (XSS) Attacco e difesaHackers vs Developers - Cross Site Scripting (XSS) Attacco e difesa
Hackers vs Developers - Cross Site Scripting (XSS) Attacco e difesa
 
Agile lean conference - Agile, Lean & Business
Agile lean conference - Agile, Lean & BusinessAgile lean conference - Agile, Lean & Business
Agile lean conference - Agile, Lean & Business
 
IPMA 2014 World Congress - Stakeholder Engagement between Traditional and Ag...
IPMA 2014 World Congress -  Stakeholder Engagement between Traditional and Ag...IPMA 2014 World Congress -  Stakeholder Engagement between Traditional and Ag...
IPMA 2014 World Congress - Stakeholder Engagement between Traditional and Ag...
 
Meetmagento 2014 hackers_onofri
Meetmagento 2014 hackers_onofriMeetmagento 2014 hackers_onofri
Meetmagento 2014 hackers_onofri
 

Owasp italy day sparql injection attacking triple store semantic web application security sql injection

  • 1. SPARQL Injection attacking the triple store Simone Luca Onofri Napolitano OWASP-Italy Day2012 Rome, 23° November 2012 Copyright © 2008 - The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License. The OWASP Foundation http://www.owasp.org
  • 2. Agenda !   Introduzione al Web Semantico !   Cos’è SPARQL !   SPARQL Injection !   Demo !   Oltre la SPARQL Injection !   Conclusioni OWASP-Italy Day 2012 OWASP
  • 3. Chi siamo !   Simone Onofri !   Luca Napolitano  10 anni di consulenza  8 anni di consulenza in ambito sicurezza, in ambito sicurezza, applicazioni, web applicazioni, reti… semantico…  Sviluppo di strumenti  Attivo in associazioni e a supporto della organizzazioni per la gestione delle sicurezza e tematiche vulnerabilità affini  Network & Security  Senior Consultant / Specialist per grandi Project Manager per aziende Techub S.p.A. OWASP-Italy Day 2012 OWASP
  • 4. Introduzione al Web Semantico OWASP-Italy Day 2012 OWASP
  • 5. Web Semantico – Cenni storici !   Teorizzato da Tim Berners-Lee negli anni ‘90 !   In teoria  Estende il web attuale  Una rete di dati che descrive dati !   In pratica  Si basa su asserzioni  Utilizza la logica dei predicati del primo ordine  Triplette di dati (soggetto, predicato, oggetto)  RDF (Resource Description Framework) OWASP-Italy Day 2012 OWASP
  • 6. Web Semantico – RDF: Struttura Io mi chiamo Simone OWASP-Italy Day 2012 OWASP
  • 7. Web Semantico – RDF: Soggetto Io <http://onofri.org/> Soggetto OWASP-Italy Day 2012 OWASP
  • 8. Web Semantico – RDF: Predicato Mi chiamo foaf:name Predicato OWASP-Italy Day 2012 OWASP
  • 9. Web Semantico – RDF: Oggetto Simone “Simone” Oggetto OWASP-Italy Day 2012 OWASP
  • 10. Web Semantico – Triplette: foaf:name <http://onofri.org/> foaf:name “Simone”. OWASP-Italy Day 2012 OWASP
  • 11. Web Semantico: Triple Store OWASP-Italy Day 2012 OWASP
  • 12. Web Semantico - Tecnologie OWASP-Italy Day 2012 OWASP
  • 13. Web Semantico – Prospettive: Open Data OWASP-Italy Day 2012 OWASP
  • 14. Web Semantico – Prospettive: Big Data BIG DATA OWASP-Italy Day 2012 OWASP
  • 16. SPARQL - Acronimo SPARQL Protocol And RDF Query Language OWASP-Italy Day 2012 OWASP
  • 17. SPARQL – Un linguaggio completo (v1.1) !   Tipologie di Query  SELECT, CONSTRUCT, ASK, DESCRIBE, UPDATE, DROP , COPY, MOVE, ADD !   Modificatori  ORDER BY, OFFSET, LIMIT, HAVING !   Espressioni  IF, COALESCE, EXISTS, IN, NOT, logiche !   Pattern  FILTER, OPTIONAL !   Funzioni  Stringhe, date, numeri, hash, xpath, xquery OWASP-Italy Day 2012 OWASP
  • 18. SPARQL – Sintassi: Literals e IRI ! Literals: Stringhe  All’interno di virgolette doppie (“) o singole (‘)  Lingua (es. @it) opzionale  Tipo di dato, tramite un IRI (es. ^^xsd:integer) opzionale (es. “Simone”@it oppure “2012-11-23”^^xsd:date) !   IRI: Internationalized Resource Identifier  All’interno di parentesti angolari (es. <http:// owasp.org/>)  oppure attraverso i prefissi (es. PREFIX foaf: <http://xmlns.com/foaf/0.1/> e foaf:name sta per <http://xmlns.com/foaf/0.1/name>) OWASP-Italy Day 2012 OWASP
  • 19. SPARQL – Sintassi: Commento (in linea) “I commenti nelle query SPARQL hanno la forma di un '#', al di fuori di un IRI o di una stringa, i commenti sono solo in linea (fino ai caratteri 0x0D o 0x0A) oppure fino alla fine del file se non ci sono nuove righe.” OWASP-Italy Day 2012 OWASP
  • 20. SPARQL – Query di base PREFIX foaf: <http://xmlns.com/ foaf/0.1/> SELECT ?name # query pattern WHERE { ?person foaf:name ?name . FILTER regex(?name, "^S", ”i") } LIMIT 10 # query modifiers OWASP-Italy Day 2012 OWASP
  • 21. SPARQL – Risposta di base ?name Sabrina Sestio Simone … OWASP-Italy Day 2012 OWASP
  • 23. SPARQL Injection – cenni storici !   2005-2008 – SPARQL 1.0 !   2008 (Aprile) – SPARQL Injection !   2009-presente – SPARQL 1.1 OWASP-Italy Day 2012 OWASP
  • 24. SPARQL Injection – Cheatsheet !   All’interno del WHERE con un literals  “# Commento con virgoletta doppie  ‘# Commento con virgoletta !   All’interno del WHERE con un IRI  ># Parentesi angolare !   All’interno dei FILTER  ‘) # e “)# Vengono usate le parentesi, una o più  All’interno di una regex !   In generale  . Terminazione di tripletta  ; Per annidare le triplette OWASP-Italy Day 2012 OWASP
  • 25. SPARQL Injection – Struttura di una app OWASP-Italy Day 2012 OWASP
  • 26. SPARQL Injection – Dove? PREFIX dbpedia: <http://dbpedia.org/ontology/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?film ?date WHERE { ?film rdf:type dbpedia:Film . ?film rdfs:label ?title . ?film dbpedia:releaseDate ?date . FILTER ((?date >= "2000-01-01"^^xsd:date) && (?date < "2012-02-01"^^xsd:date) && regex(str(?title), "^R")) } OWASP-Italy Day 2012 OWASP
  • 27. SPARQL Injection – Conclusioni !   L’impatto varia secondo  La struttura della query  Dov’è possibile inserire il codice  Utilizzo di comandi dai vari dialetti (es. LOAD) !   Non solo SPARQL Injection  Xquery  Xpath  Regex !   Mitigazione  Query Parametriche  Validazione dei dati  Scrivere SPARQL correttamente OWASP-Italy Day 2012 OWASP
  • 29. Demo – Semantic Login: Schermata OWASP-Italy Day 2012 OWASP
  • 30. Demo – Semantic Login: Codice OWASP-Italy Day 2012 OWASP
  • 31. Demo – Semantic Login: richiesta (legit) OWASP-Italy Day 2012 OWASP
  • 32. Demo – Semantic Login: risposta (legit) OWASP-Italy Day 2012 OWASP
  • 33. Demo – Semantic Login: richiesta (injection) OWASP-Italy Day 2012 OWASP
  • 34. Demo – Semantic Login: risposta (injection) OWASP-Italy Day 2012 OWASP
  • 35. SPARQL Injection – Dov’è il bug OWASP-Italy Day 2012 OWASP
  • 36. Oltre la SPARQL Injection OWASP-Italy Day 2012 OWASP
  • 37. Oltre la SPARQL Injection – dietro… OWASP-Italy Day 2012 OWASP
  • 38. Oltre la SPARQL Injection – SQL Injection OWASP-Italy Day 2012 OWASP
  • 39. Oltre la SPARQL Injection - Query SPARQL PREFIX iam: <http://x> SELECT * WHERE { ?user iam:user "lol*/ OR (SELECT sleep(5))=1--" . } LIMIT 100 OWASP-Italy Day 2012 OWASP
  • 40. Oltre la SPARQL Injection - Query SQL SELECT T_0_0_0.s AS `user`, T_0_0_0.s_type AS `user type` FROM arc_tests_triple T_0_0_0 WHERE (T_0_0_0.p = 0) /* http://xuser */ AND (T_0_0_0.o = 0) /* lol*/ OR (SELECT sleep(5))=1-- */ LIMIT 100 OWASP-Italy Day 2012 OWASP
  • 41. Bonus – Dov’è il bug OWASP-Italy Day 2012 OWASP
  • 42. Oltre la SPARQL Injection – Dettagli ARC v2011-12-01 Multiple vulnerabilities http://onofri.org/u/arc2012 http://onofri.org/u/vm2012 OWASP-Italy Day 2012 OWASP
  • 44. Grazie! Domande? !   Simone Onofri !   Luca Napolitano simone.onofri@gmail.com beinux3@gmail.com @simoneonofri @beinux3 http://onofri.org/u/sparqli2012 OWASP-Italy Day 2012 OWASP
  • 45. Riferimenti !   Tim Berners-Lee - Weaving the Web http://www.w3.org/People/Berners-Lee/Weaving/Overview.html !   W3 - SPARQL Query Language for RDF http://www.w3.org/TR/rdf-sparql-query/ !   SPARQL 1.1 Query Language http://www.w3.org/TR/sparql11-query/ !   Code Injection http://www.morelab.deusto.es/code_injection/ OWASP-Italy Day 2012 OWASP