-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. Added SQLi via Content Provider vulnerability 3. Added Data injection via insecure content provider vulnerability
- Loading branch information
1 parent
6b6740f
commit b0fa418
Showing
17 changed files
with
183 additions
and
57 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
app/src/main/java/com/BugBazaar/ui/addresses/AddressContentProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.BugBazaar.ui.addresses; | ||
|
||
import android.content.ContentProvider; | ||
import android.content.ContentUris; | ||
import android.content.ContentValues; | ||
import android.database.Cursor; | ||
import android.database.sqlite.SQLiteDatabase; | ||
import android.net.Uri; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
public class AddressContentProvider extends ContentProvider { | ||
private AddressDatabaseHelper dbHelper; | ||
|
||
@Override | ||
public boolean onCreate() { | ||
dbHelper = new AddressDatabaseHelper(getContext()); | ||
return true; | ||
} | ||
|
||
@Override | ||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { | ||
SQLiteDatabase db = dbHelper.getReadableDatabase(); | ||
|
||
// Add condition to exclude addresses containing "0xSuper_Secret0x" | ||
String newSelection; | ||
if (selection != null && !selection.isEmpty()) { | ||
newSelection = selection + " AND " + AddressContract.AddressEntry.COLUMN_NICKNAME + " NOT LIKE '%0xSuper_Secret0x%'"; | ||
} else { | ||
newSelection = AddressContract.AddressEntry.COLUMN_NICKNAME + " NOT LIKE '%0xSuper_Secret0x%'"; | ||
} | ||
|
||
Cursor cursor = db.query(AddressContract.AddressEntry.TABLE_NAME, | ||
projection, | ||
newSelection, | ||
selectionArgs, | ||
null, | ||
null, | ||
sortOrder); | ||
|
||
cursor.setNotificationUri(getContext().getContentResolver(), uri); | ||
return cursor; | ||
} | ||
|
||
|
||
@Nullable | ||
@Override | ||
public String getType(@NonNull Uri uri) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Uri insert(Uri uri, ContentValues values) { | ||
SQLiteDatabase db = dbHelper.getWritableDatabase(); | ||
long id = db.insert(AddressContract.AddressEntry.TABLE_NAME, null, values); | ||
getContext().getContentResolver().notifyChange(uri, null); | ||
return ContentUris.withAppendedId(uri, id); | ||
} | ||
|
||
@Override | ||
public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { | ||
return 0; | ||
} | ||
|
||
// Implement other necessary methods: update, delete, getType, etc. | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/BugBazaar/ui/addresses/AddressContract.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.BugBazaar.ui.addresses; | ||
|
||
import android.net.Uri; | ||
import android.provider.BaseColumns; | ||
|
||
public class AddressContract { | ||
|
||
public static final class AddressEntry implements BaseColumns { | ||
public static final Uri CONTENT_URI = Uri.parse("content://com.bugbazaar.provider.addresses/addresses"); | ||
//public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon().appendPath(PATH_ADDRESSES).build(); | ||
public static final String TABLE_NAME = "addresses"; | ||
public static final String COLUMN_NICKNAME = "nickname"; | ||
public static final String COLUMN_ADDRESS = "address"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Wed Jul 26 10:25:33 IST 2023 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |