Skip to content

Hadoop (Yarn tasks) compromise analysis#243

Merged
aarontp merged 26 commits into
google:masterfrom
rgayon:hadoop
Sep 19, 2018
Merged

Hadoop (Yarn tasks) compromise analysis#243
aarontp merged 26 commits into
google:masterfrom
rgayon:hadoop

Conversation

@rgayon

@rgayon rgayon commented Aug 29, 2018

Copy link
Copy Markdown
Collaborator

This analysis task looks into the Hadoop AppRoot directory, where Yarn tasks are saved. In case of a compromise, those usually also save the malicious tasks that were created.
Currently, we naively run strings on each of these files and search for post-compromission trivial artifacts (curl or wget, to pull malware).

This depends on the extract_artifacts() methods from turbinia/lib/utils.py which is going to be added by #226
I'm not using FileArtifactExtractionTask as I want to extract all the AppRoot files as one evidence to generate only one report (it is expected that a large amount of Yarn tasks are going to be analyzed while only a handful of them will contain malicious commands)

@rgayon rgayon changed the title WIP : Hadoop compromise analysis Hadoop (Yarn tasks) compromise analysis Sep 7, 2018
@aarontp

aarontp commented Sep 7, 2018

Copy link
Copy Markdown
Member

Cool, looking good. I see it's no longer tagged with WIP, but I don't see reviewers assigned yet, so ping me (or assign reviewers) when you're ready. Thanks!

@rgayon

rgayon commented Sep 10, 2018

Copy link
Copy Markdown
Collaborator Author

I wanted to let the tests fail miserably (and make sure they do because #226 is not merged yet)

@rgayon

rgayon commented Sep 10, 2018

Copy link
Copy Markdown
Collaborator Author

Seems like I actually can't assign a reviewer.

@aarontp aarontp self-requested a review September 18, 2018 09:00

@aarontp aarontp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For some reason I don't see this failing on lint errors, but that might be because they are hidden due to it failing on other hard errors like util not being there yet (because #226 isn't submitted yet). I'll see if we can get that merged so that we can clear up the errors on this one. I'm adding some other review comments for now, but most of it is just small nits. Thanks!

Comment thread turbinia/jobs/__init__.py Outdated
Comment thread turbinia/jobs/hadoop.py Outdated
Comment thread turbinia/workers/hadoop.py Outdated
Comment thread turbinia/workers/hadoop.py Outdated
Comment thread turbinia/workers/hadoop.py Outdated
Comment thread turbinia/workers/hadoop.py Outdated
Comment thread turbinia/workers/hadoop.py Outdated
Comment thread turbinia/workers/hadoop.py Outdated
fh.write('\n'.encode('utf8'))

result.add_evidence(output_evidence, evidence.config)
result.close(self, success=True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we add a status that summarizes the report somehow here? Some of the other tasks have been setting the first line of the report to be something like a summary, and then using that as the status. This way it will show up in the turbiniactl output directly (and the default is something generic).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

First line of the report now says whether badness has been found

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add that first line as the status parameter here too then? e.g.:
result.close(self, success=True, status=text_report.splitlines()[0])

@aarontp

aarontp commented Sep 18, 2018

Copy link
Copy Markdown
Member

FYI, #226 is now submitted. It looks like tests are failing on a separate issue more specific to your PR now. LMK when you want me to want me to PTAL, :).

@rgayon

rgayon commented Sep 18, 2018

Copy link
Copy Markdown
Collaborator Author

Please PTAL a look

@aarontp aarontp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LG, just a couple small things.

Comment thread turbinia/workers/hadoop.py
Comment thread turbinia/workers/hadoop.py Outdated
fh.write('\n'.encode('utf8'))

result.add_evidence(output_evidence, evidence.config)
result.close(self, success=True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add that first line as the status parameter here too then? e.g.:
result.close(self, success=True, status=text_report.splitlines()[0])

Comment thread turbinia/workers/hadoop.py Outdated

@aarontp aarontp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM Thanks!

@aarontp aarontp merged commit 6f031ea into google:master Sep 19, 2018
Onager pushed a commit to Onager/turbinia that referenced this pull request Sep 21, 2018
* empty shell

* more scaffholding

* make all of this more simple

* Things appear to be working

* typo

* undo some filepath manipulations

* register the new hadoop Job

* cleanup

* renamed

* fix output evidence

* add tests

* typo

* styleguide

* full path to strings

* comments

* sync

* fix tests

* fix py3 tests

* fix py3 harder

* I call this 'bruteforce programming'

* Make _AnalyzeHadoopAppRoot return a list of string, to use the first one as status on the result Evidence

* remove extra tab

* also check at the beggining of the line
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.

2 participants