Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement LFI #2770

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Implement LFI #2770

wants to merge 29 commits into from

Conversation

estringana
Copy link
Contributor

@estringana estringana commented Jul 23, 2024

Description

This PR implements the first exploit prevention added to PHP. That means that apart of wrapping the LFI php functions, it also implements everything else to report exploits. This PR consists on:

  • Wrapped certain file operations
    • file_get_contents
    • file_put_contents
    • fopen
    • readfile
  • Add exploit preventions metrics
  • Add LFI capability to RC
  • Add rasp configurations

Related Jiras: APPSEC-52929, APPSEC-53812, APPSEC-53813

@estringana estringana changed the base branch from master to estringana/report-backtrace July 23, 2024 11:12
@codecov-commenter
Copy link

codecov-commenter commented Jul 23, 2024

Codecov Report

Attention: Patch coverage is 39.70588% with 41 lines in your changes missing coverage. Please review.

Project coverage is 78.07%. Comparing base (46173ca) to head (fdbbb12).

Files with missing lines Patch % Lines
.../Integrations/Filesystem/FilesystemIntegration.php 0.00% 37 Missing ⚠️
appsec/src/extension/ddappsec.c 87.50% 0 Missing and 2 partials ⚠️
appsec/src/extension/tags.c 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2770      +/-   ##
============================================
- Coverage     80.91%   78.07%   -2.84%     
- Complexity     2526     2535       +9     
============================================
  Files           146      174      +28     
  Lines         14713    18811    +4098     
  Branches          0      992     +992     
============================================
+ Hits          11905    14687    +2782     
- Misses         2808     3581     +773     
- Partials          0      543     +543     
Flag Coverage Δ
appsec-extension 68.50% <87.09%> (?)
tracer-extension 78.10% <ø> (ø)
tracer-php 81.80% <0.00%> (-0.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
appsec/src/extension/backtrace.c 71.15% <100.00%> (ø)
appsec/src/extension/commands/request_exec.c 100.00% <100.00%> (ø)
appsec/src/extension/configuration.h 100.00% <ø> (ø)
appsec/src/extension/user_tracking.c 71.69% <100.00%> (ø)
appsec/src/extension/ddappsec.c 72.13% <87.50%> (ø)
appsec/src/extension/tags.c 79.80% <75.00%> (ø)
.../Integrations/Filesystem/FilesystemIntegration.php 0.00% <0.00%> (ø)

... and 21 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 46173ca...fdbbb12. Read the comment docs.

@pr-commenter
Copy link

pr-commenter bot commented Jul 23, 2024

Benchmarks

Benchmark execution time: 2024-09-20 09:39:55

Comparing candidate commit eb254e3 in PR branch estringana/implement-lfi with baseline commit 339adfc in branch estringana/add-appsec-benchmarks.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 11 metrics, 0 unstable metrics.

scenario:WordPressBench/benchWordPressOverhead-appsec

  • 🟥 execution_time [+3.357ms; +3.691ms] or [+12.342%; +13.570%]

@estringana estringana force-pushed the estringana/implement-lfi branch 5 times, most recently from 96857dd to f710e93 Compare July 29, 2024 09:52
@estringana estringana force-pushed the estringana/report-backtrace branch 2 times, most recently from af1a36f to 1ac82f6 Compare July 30, 2024 09:08
@estringana estringana force-pushed the estringana/implement-lfi branch 2 times, most recently from 26c41f1 to 2b2ebb0 Compare August 2, 2024 11:20
@estringana estringana force-pushed the estringana/implement-lfi branch 5 times, most recently from 3ff1e35 to 3d4bf57 Compare August 9, 2024 09:30
@estringana estringana force-pushed the estringana/implement-lfi branch 2 times, most recently from e59193b to 3618a4d Compare August 12, 2024 09:35
@estringana estringana force-pushed the estringana/report-backtrace branch 3 times, most recently from 0304b3e to 83e6358 Compare August 13, 2024 08:25
Base automatically changed from estringana/report-backtrace to master August 21, 2024 13:45
@@ -0,0 +1,105 @@
--TEST--
Filesystem integration depends on RASP. If RASP enabled, integration is enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this one. What it shows enabled is your TestSandboxedIntegration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants